cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate CPP code into STM32CubeIDE C project?

Seenu
Associate II

I have STM32CubeIDE C project already running for an application.

I am planning to integrate a GIT submodule (CPP code) for proprietary communication.

Is it possible to add the CPP module into existing C project and run?

Please assist.

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

Create the STM32 project with C++ target language option. This enables both, C and C++.

hth

KnarfB

View solution in original post

7 REPLIES 7
KnarfB
Principal III

Create the STM32 project with C++ target language option. This enables both, C and C++.

hth

KnarfB

Thanks for the reply.

Is it possible to add the CPP files to existing STM32CubeIDE project?

AFAIR not. Create a new dummy STM32 C++ project, delete its sources and move the existing code into it?

hth

KnarfB

Bob S
Principal

It is possible to convert an existing project to use c and c++. In CubeIDE, select the desired project in the "Project Explorer" window. Right-click on the project and select "Convert to C++" (near the bottom of the menu).

You will need to update the project to find the new include files and new source files. To add include directories go to project properties, the "C/C++ Build-> Settings". Look for "Include Paths" and add your new include directory. Do this al ALL BUILD TYPES (i.e. debug and release) as well as both "MCU GCC Compiler" and "MCU C++ Compiler" settings. To add the source directory, in the project properties select "C/C++ General->Paths and Symbols". Click on the "Source Location" tab and add the folder with your new files.

badiw
Associate II

There is no such submenu in the current IDE (1.13.2)

1. for new -> project -> stm32project -> select cpu -> then:

AScha3_0-1700474658428.png

- give name + sel. c++

2. on existing project right mouse click -> on existing project

AScha3_1-1700474752418.png

- then choose : convert to c++

ok?

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

Please learn to in-line images into posts, doing it as attachments with the same name is particular tedious under Android.. Thanks

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..