cancel
Showing results for 
Search instead for 
Did you mean: 

Import existing files into Cube project

Johannes Hofmann
Associate II

Hi there,
I used Rowley Crossstudio for STM32L011 development so far but wanted to try the CubeIDE as well.
But upon generating a fresh STM32 project and importing my c++ files from my directory, I can't build the project because in the properties there is no c/c++ builder option present.
How can I solve this or properly setup my project?

Regards,
Hannes

JohannesHofmann_0-1720292159156.png

 

7 REPLIES 7
Pavel A.
Evangelist III

To use C++ sources, convert your new CubeIDE project to C++. Right click on the project in the Project explorer pane and select "convert to C++". This will enable the C++ compiler and linker.

Next, please read the CubeIDE user manual on creating and importing projects. This manual is available in Help-> Information center-> STM32CubeIDE User guide.

 

 

Johannes Hofmann
Associate II

Hey Pavel,
Thanks for the quick reply.
I set up the project already as "C++" in the "STM32 project" wizard when I generated it.
Or do you mean somewhere else? Because there is no "Convert" option in the right click menu:

JohannesHofmann_0-1720538366510.png

Regards,
Hannes

Pavel A.
Evangelist III

Hmm. Strange.

Try to import some example and see how it looks in the Project explorer pane.

 

AScha.3
Chief III

Hi,

so you started new project as C++ . ok.

It will do it then...need nothing to adjust. BUT main.c still C , but should be no problem.

See : you setup cpu with Cube/HAL , all is in C. So just add your c++ files (-> import..c++ + .h files ), then it should work. Compiler is in C for the start/init in main, and C++ for your added files, linker puzzles it together.

Try..

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

Hi,
If I create a project, using my existing CubeMX file, it generates this project with the HAL overhead that I don't want/need.
In my existing project, which I started in the other IDE, I coded the hardware implementation myself as this HAL is not good readable in my opinion and also exceeds my STM32L011's memory capabilities upon building just the empty project.

@AScha.3 
Is there a way, to delete the generated contents and only import my file tree?

Hi,

i dont understand:

1. you use Cube/.ioc to ...what ? no code generation?

2. If with genereated code, what is "overhead" then? Init the things you set to use them?

3. If no code generation needed, dont use it. Or let it it init a chip, with nothing used, except debug.

And set optimizer to -O2 , not leaving it at -O0 !

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

@Johannes Hofmann But are C/C++ build settings visible in the project properties? You can remove all the HAL stuff later.