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.
Well ESP-IDF is special because it uses the CMake system on top of the PlatformIO’s regular standardized build system (where your sources are in src/ or lib/`), but if you have a CMakeLists.txt that builds sources outside of this folder, it should also work in PlatformIO.
Sorry, I don’t quite understand what you mean, does this mean that for ESP32 project I can’t create a folder like USER by myself, but for other projects like drduino nuo project I can do it? Thanks again for your patient answer.
In addition, as shown in the figure, although the third-party library ArduinoJson I introduced prompted that the file could not be found, it did not report an error during construction. Why?
Please see README, you need to create a new folder in lib/ for your library (e.g. name “user”) and put the .cpp and .h files in that folder. Also don’t forget to do a tools → platformio → re-init in CLion after that to update Intellisense.
No the reverse. For an Arduino Uno project you’re bound to PlatformIO folder structure, for ESP32 + ESP-IDF you have the CMakeLists.txt to possibly do things like adding sources outside of PlatformIO’s regular source folder