To facilitate project management,I always I often create some files myself, but when I add .c and .h file in Clion and this project using espressif32 platform, I meet some question.My steps are as follows:
- I created a folder under the project path named
USER
and this path includes oledself.cpp and oledself.h files.
in oledself.cpp and oledself.h I define a function.
- I created a file named
CMakeListsUser.txt
in the project directory and modified its contents as follows
- I add the oledself.h file in the
main.cpp
and calloled_init()
in the main function.
Then the following error occurred,
Compiling .pio\build\pico32\src\main.cpp.o
src\main.cpp:5:22: fatal error: oledself.h: No such file or directory
******************************************************************
* Looking for oledself.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:oledself.h"
* Web > https://platformio.org/lib/search?query=header:oledself.h
*
******************************************************************
compilation terminated.
*** [.pio\build\pico32\src\main.cpp.o] Error 1
========================== [FAILED] Took 4.51 seconds ==========================
CMakeFiles\Debug.dir\build.make:56: recipe for target 'CMakeFiles/Debug' failed
CMakeFiles\Makefile2:105: recipe for target 'CMakeFiles/Debug.dir/all' failed
CMakeFiles\Makefile2:112: recipe for target 'CMakeFiles/Debug.dir/rule' failed
Makefile:130: recipe for target 'Debug' failed
mingw32-make.exe[3]: *** [CMakeFiles/Debug] Error 1
mingw32-make.exe[2]: *** [CMakeFiles/Debug.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles/Debug.dir/rule] Error 2
mingw32-make.exe: *** [Debug] Error 2
It is worth noting that I can open the oledself.h and oledself.c file in main.cpp.
I want to know where is the problem. Thank you.