cancel
Showing results for 
Search instead for 
Did you mean: 

When copying a STM32 Project to a new C/C++ Managed Build Project, I am encountering header file location errors because I don't know how to duplicate the auto-generated project links under the master {project} Includes "directory."

DWild.1
Associate II

It has the auto-generated plugin include "links", but I am missing the following.

{project}/Core/Inc

{project}/Drivers/CMSIS/Device/ST/STM32G4xx/Include

{project}/Drivers/CMSIS/Include

{project}/Drivers/STM32G4xx_HAL_Driver/Inc

{project}/Drivers/STM32G4xx_HAL_Driver/Inc/Legacy

I am concerned that if I just create a real {project}/Includes directory and start adding symbolic links that will conflict with the auto-generated plugin links that already are there. 

The other alternative I see is to auto-generate a new project using the STM32 Wizard, and then go back in and add the C++ tools in a C++ Build Settings configuration (enabling g++)..

The 1.8.0 IDE is running on a Ubuntu 20.04 LTS system. I also would like to make this project build on a Win10 system, but I am not a Windows coder and I do not know how to make the Doze equivalent of 'symlinks'.

I'd rather learn to do this correctly rather than fixing each individual error by copying the header files all over the place! Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
mattias norlander
ST Employee

The original project that you are trying to copy. Exactly how was it created?

The answer will depend on that...

More specifically I am curious as to if you kep the default setting here:

0693W00000JOFTCQA5.pngThe default is "Copy only the necessary files". This means the all c/h-files are physically copied from your CubeFW repo into your project. No Eclipse/symlinks.

Assuming you kept this default, then the next question is how you tried to duplicate resources. If you drag and drop resources in the CubeIDE project explorer view, then you can move/copy/symlink (symlink in this case is just an Eclipse metadata link) the resource. On Windows default is move. By holding CTRL, you make a copy. By holding ALT you make an Eclipse link.

If you moved or copied the include path should be simple verify.

If you create a link, then I think that the include path should still point at the original location of the file. Not where it is linked. Not 100% certain.

Maybe this is your issue.

But the entry point to this whole situation is that you want to turn a C project into a C++ project?

If so, right-click on your project > Convert to C++. Careful, you have to walk-through the Assembler and C++ compiler settings to make sure they are OK. We cannot automatically move all settings.

View solution in original post

4 REPLIES 4
mattias norlander
ST Employee

The original project that you are trying to copy. Exactly how was it created?

The answer will depend on that...

More specifically I am curious as to if you kep the default setting here:

0693W00000JOFTCQA5.pngThe default is "Copy only the necessary files". This means the all c/h-files are physically copied from your CubeFW repo into your project. No Eclipse/symlinks.

Assuming you kept this default, then the next question is how you tried to duplicate resources. If you drag and drop resources in the CubeIDE project explorer view, then you can move/copy/symlink (symlink in this case is just an Eclipse metadata link) the resource. On Windows default is move. By holding CTRL, you make a copy. By holding ALT you make an Eclipse link.

If you moved or copied the include path should be simple verify.

If you create a link, then I think that the include path should still point at the original location of the file. Not where it is linked. Not 100% certain.

Maybe this is your issue.

But the entry point to this whole situation is that you want to turn a C project into a C++ project?

If so, right-click on your project > Convert to C++. Careful, you have to walk-through the Assembler and C++ compiler settings to make sure they are OK. We cannot automatically move all settings.

Hi, Mattias!

I did see that, but it was grayed-out in my build. I will go from scratch again and make it work using both your suggestions. (I made a lot of new projects yesterday!) I did discover that the project-specific settings for C/C++ building are more elaborate than the global WS settings pages (hint!).

Thank you for your help! I did not know about the right-click convert option!

It successfully adds the links now, Matthias. I looked for the 'convert to C++' option but it only shows a 'convert to C' option.

What still remains is that it doesn't convert main.c to main.cpp, but that's a much simpler problem! ��

Fully functional now. I've added a new source folder and namespace so my code and other developers who write in C can coexist.

Now, to get ambitious and try adding BOOST! ��