cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE: Imported Eclipse 'C' Project incorrectly defines __cplusplus

STM32 CubeIDE v1.5.1; Build: 9029_20201210_1234 (UTC)

The same Eclipse Project as:

https://community.st.com/s/question/0D53W00000Y2lIsSAJ/cant-usecreate-debug-config-for-oss7-stack

It is a 'C' Project, but the CubeIDE defines __cplusplus:

0693W000007ZDYEQA4.png 

Which, as you can see, messes-up the codes checks to see if C++ is being used!

If I manually delete that definition, all is fine.

The problem does not happen when opening the project in a "normal" Eclipse Neon 3.

So why is CubeIDE adding this?

33 REPLIES 33

Back on the original topic of __cplusplus, I noticed this in my most recent attempt to import into CubeIDE v1.6.0:0693W000008wfYRQAY.pngI didn't notice that before - maybe it explains why the project had both "ccnature" and also "cnature" ?

​@mattias norlander​  - "Is this a better way forward? It may have both pros and cons. We are always interested in feedback..."

It's a start - there are two clunky bits:

  1. Your "little stunt" to be able to specify the MCU;
  2. The faffing about to find the source files.

I just tried it with importing an Eclipse CDT project: that finds all the source files OK, and builds OK, but the Project Properties doesn’t have the ‘C/C++ Build’ page (it comes between ‘Builders’ and ‘C/C++ General’ for a makefile project):

0693W000008wl1nQAA.pngSo it remains impossible to debug a "plain vanilla" Eclipse Project in Cube IDE.

As @Pavel A.​  noted above, I think that's an issue for people who don't have a makefile project to start with - irrespective of any misgivings about how I created my particular project.

So the key issue here is how to specify the target chip for the Debug setup to work.

So what we need is just that the 'MCU Settings' GUI is permanently available?

@Andrew Neil​ 

> As @Pavel A. (Community Member)​ noted above, I think that's an issue for people who don't have a makefile project to start with

Andrew, what I wrote is the opposite, the situation when user has an existing makefile based "generic" eclipse CDT project.

When there's no project, Mattias described how to create it and this works.

-- pa

Sorry if I misrepresented you.

What I meant is:

  • If you just have a makefile - no Eclipse project - Mattias's approach works;
  • If you have an Eclipse project, you still can't get that into CubeIDE and get debug working.

So there is still work to be done.

Hi Pavel,

Did you press the Apply button after ticking "Generate Makefiles automatically"?

WBR Alec

mattias norlander
ST Employee

Hi Andrew,

About folder vs source folder.

In your project "OSS7-Make" the very project root folder is setup as a "source folder". It means the that the build system will scan for c-files recursively from project root.

It may be more common practice to instead define certain folders contain c-files and only let build system scan these. This is what the "source folders" let you do. If you add a regular "folder" it is not considered by the build system when scanning for c-files.

There is however always a BUT... Here goes: BUT, if you have the project root folder as a source folder, then all child folder MUST be only "folders". Otherwise Eclipse/CDT will be confused and visualise a folder named "stack" as "OSS7/src/stack".

Old Eclipse/CDT bug... Not something we plan to try to fix, so many other more important things where we can contribute in CDT...

You can determine if a folder is a "source folder" or a normal "folder" by looking at if the icon is decorated with a small blue/white C. Your screenshots provide good examples with the project root vs the OSS7/src/stack. This folder should be re-created as a normal folder...

Second issue:

"If you have an Eclipse project, you still can't get that into CubeIDE and get debug working."

It should be possible to make this work too... I have this working on my machine. Or I missunderstand the use case in some way.

So my understanding is that you have a normal Eclipse/CDT vanilla project. You want to build and debug it in CubeIDE.

It should work both with managed (auto-generated makefiles) and unmanaged mode (relying on your makefile).

Could you describe how you imported the project in CubeIDE? In your case you should be doing just a file > Open projects from filesystem... should work!

If relying on your own makefile you have to perform the "little stunt" in step 4.1-4.7...

If relying on managed build with auto-generated makefiles you will still need to select our toolchain integration and the correct MCU to be able to debug.

@mattias norlander​ : "To make debug work the debugger integration needs to know which MCU you are targeting. Because of a known issue in CubeIDE 1.6.0, you have to perform a little stunt" (March 4, 2021 at 3:30 PM)

We're now up to CubeIDE v1.7.0 - is the "little stunt" still required ?

Hi Andrew,

Yes, unfortunately the stunt will still remain required.

There is no easy way to get rid of "the little stunt" without making more substantial changes.

Those changes are not justified by the moderate usage numbers we see related to CDT projects.

Kind regards, Mattias

OK, thanks

'Liked' as an honest answer :thumbs_up:

the outcome - not so much :\

Cheers,

Andy.