cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up a C++ project for a NUCLEO-F446RE

drtarr
Associate

Apologies for the newbie question, but I am trying to init a project with the following as starting point:

  • STM32CubeIDE v1.17.0
  • NUCLEO-F446RE
  • C++ Development
  • FreeRTOS
  • CAN Interface

 

When creating projects it looks like there's a lot of options, but I can't seem to get the combination of C++ and STM32CubeMX file for my NUCLEO board.  Two options I've tried for creating a project:

 

The New "C/C++ Project" with "C++ Managed Build" option:

drtarr_0-1733626887547.png

Produces a `hello-world.cpp` with the following contents:

 

 

 

#include <iostream>
using namespace std;

int main() {
	cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	return 0;
}

 

 

However it has on specific build target, no STM32CubeMX .ioc file, or ld linker file.

 

The New "STM32 Project" with "C++" as the "Targeted Language" option:

drtarr_2-1733627144929.png

drtarr_3-1733627575605.png
drtarr_4-1733627678327.png

I get the STM32CubeMX .ioc file for the board but everything otherwise still looks like a C project. All the generated code is in C and the includes don't include anything C++ related.

 

Edit: Looking at the code closer it seems that maybe this is the structure of the C++ project, however, making a simple class definition it chokes on the the keyword 'class' so I suppose something is still wrong.  If someone could steer me towards the right documentation I think that's what I need.

 

Am I missing something? Also - I'm looking for good STM32CubeIDE tutorials but the 'Tutorial' playlist under STMicroelectronics Youtube channel has no voice over and is sorta useless IMO. So please feel free to direct me to the right materials.

Thanks

2 REPLIES 2
drtarr
Associate

Specifically, the video tutorials linked in Help->Video tutorials are the ones I'm referring to.  They go quite fast and have no voice over, but also the hyperlink for the FreeRTOS one is broken:

drtarr_0-1733629298334.png

Instead it takes you directly to Azure RTOS TraceX

 

Pavel A.
Evangelist III

CubeIDE has user guide where you can find how to set up a C++ project. Just one thing: both .c and .cpp files can be in a c++ project. This is not a problem. In an extreme case, all files in a c++ project can be .c ))  And no, "class" keyword does not work in .c files ))

Please take your time, read and enjoy videos.  If the project is urgent and deadline is close, help can be found here.