'Where to add new .h and .cpp file in STM32CubeIDE project
I used STM32CubeIDE to create a new (C++) project for my nucleo-f411re board by File > New > STM32 Project. The project was created as usual. I renamed "main.c" to "main.cpp" since I selected C++ as the target language. A simple "blinky" compiles and runs correctly on the board. So now I want to begin adding some C++ code to the project.
The "main.cpp" is in the project tree under myproject > Core > Src > main.cpp. If I want to create some new source/header files, say "foo.h" and "foo.cpp", I think I can right-click on something in the project tree, then New > Header File or New > Source File. But the question is -- what do I right-click on to create the source/header file? I assume the file will be created in the location (= folder) I right-click on. Where do I want to put them? Both of them in the "Core" folder? Separately in "Core > Inc" and "Core > Src" folders? I'm not sure.
Edit: I added the header/source files to Core > Inc and Core > Src respectively, and that seems to work. Is that recommended? I wonder if they will still be there if I change the configuration, causing the code to be regenerated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
