cancel
Showing results for 
Search instead for 
Did you mean: 

how can I manage my code with cubeIDE

deep_rune
Associate III

I'm a beginner using stm32 and cubeIDE. I find that having all the setup and functions in one file is a little annoying to navigate - is there a way I can put my functions in a different file, for example? Or what are some way of managing large programs and keeping them neat and easy to navigate?

4 REPLIES 4
TDK
Guru

> I find that having all the setup and functions in one file is a little annoying to navigate

The "outline" view can be used to jump to files within a function. Pressing F3 while within a function name will jump to its definition. Both can be helpful for navigating within the source code.

> is there a way I can put my functions in a different file, for example? Or what are some way of managing large programs and keeping them neat and easy to navigate?

Functions grouped into files different based on functionality is common. You can add source files just by creating a new file within a source directory. You can also make a new directory and mark it as a source directory to further group files. I think the default organization produced by CubeMX is fairly typical of large programs.

If you feel a post has answered your question, please click "Accept as Solution".
deep_rune
Associate III

Thanks, when I add a new file to the source directory and add the functions there instead in main.c i get a lot of compiler errors - is there something I need to add to the file (an include etc.) to make it work?

TDK
Guru

I can't see the error messages on your screen. Use those to guide you as to what the problem is, and if including header files would solve it. It is rare to have a source file which has no includes, but it is possible.

If you feel a post has answered your question, please click "Accept as Solution".
deep_rune
Associate III

for example one of my functions references a LUT in main.c - after I move the function to an external file it shows an error as it no longer knows where the LUT is. How can I solve this error?