My proeject doesn't compile because it apparently doesn't see the correct header whose is correctly defined

Hi all, how are you?.
I have a project where I have a function in main but is defined in a header, that header is correctly defined in the project and if I do ctrl + click over the function in the main file, the IDE redirects correcty to the .cpp definition file.

In the status bar there is a message that says “Is not active kit” but when I press that message then it doesn’t find the kit, on the other hand when I try to compile the project then there is a message that says

“incorrect Cmake executable: check that it is installed or check that the value of the variable cmake.cmakepath contains the correct route”.

This happens in a machine with windows 10 Pro 64 bits and Plaftormio Core 6.1.11, Home 3.4.4

the main file calls a function called Compara_RTC, that function is defined in the files called reoj.h nad reloj.cpp and all of them are stored in src folder of the project.

What can I do?

That comes from the CMake extension. Not PlatformIO. If you have a PlatformIO project, the CMake extension should be deactivated in the workspace.

I dissabled the cmake extension and rebuilt the intellisense index, now it didn’t have the problem with cmake but it keeps giving the error that it doesn’t find the definition of my function, I’ve even reinstalled from zero vscode and platformio and the problem remains

There could be many reasons for why the function definition isn’t found. Can you show the exact project files, e.g. uploaded to github?

Yes, the project is here.

Basically I’m doing a refactoring of the code to start making it modular but that is the only functions that bothers me roght now

now is public, you can access it


There is no problem on my side.

then is my installation of platformio what is doing bad things, I think is the linker, so, what can you advice to do to solve the problem

here is the error

like I said, I installed vscode and platformio from zero several times

There are is no Compara_RTC() function the code you’ve uploaded. Pelase update your repo.

Sorry for that, I’ve updated the the repo but you must change to the branch tema-web-modo-nocturno, there is the problem

I see the problem.

You’ve used

#ifndef RELOJ_H
#define RELOJ_H

#endif

in more than one .h fil, i.e. estdado.h and reloj.h. But this include guard macro must be unique.

Since your main.cpp includes estado.h, it gets a #define RELOJ_H definition. When it goes to #include "reloj.h", it does not get any of the function definitions because all of that is inside the #ifndef RELOJ_H (if not defined) block.

In addition to that, you have really bad cyclic dependencies going on. Your backend.h includes reloj.h which includes backend.h (???). That’s not good practice at all.

I would recommend a major refactor in which you cleanly separate the type definitions into one header file, and that should not include any other file. You also have to get rid of the circular dependency by exactly introducing a third file.

See https://github.com/VALERYRAMIREZ/Sis_Hidro/pull/1 for the most minimal compile fix.

Thanks a lot Max, very useful help