Relative Content

Tag Archive for c++cmakevisual-studio-2022raspberry-pi-pico

C/C++ header cannot be read/accessed by compiler with CMake files addressing the directory containing the header

I am having an issue with the compiler not reading a header file. I am working with a one-wire library for reading the temperature on a DS18B20 using a Raspberry Pi Pico, I copied it through aa git and made a new directory for it via the command prompt using build tools. To use this library for my project I stored this in the directory C:SDKpico-sdklibMyProjectLibpico_one_wire where it has subdirectories that hold the source code and header file. This is separate from my project file itself to avoid clutter. I don’t see much issue with this approach since I know the directories I will utilize. I am using CMake to build the project, address these directories, and target the libraries containing the header file and source code. So far I was able to address the source file one_wire.cpp without issue but the issue with the header file and the compiler remains. I get the error message on the line I stated #include "one_wire.h" which states fatal error: one_wire.h: No such file or directory. My question is, what is causing the compiler to fail to read the header while stating compiling? I suspect it has to do with my CMake file itself, but I do not know how since I included the same directory below. Any help would be appreciated, thank you. Here is my Cmake file below