cancel
Showing results for 
Search instead for 
Did you mean: 

the main.c file generated with stm32cubeide should replace its fixname as .cpp

yujin
Associate II
 
9 REPLIES 9

Sorry what's the question?

With .cpp / C++ builds watch for name mangling and related linker issues. Also initialization of constructors prior to external memories being viable.

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

it work well if the suffix-name of main.c and stm32f3xx_it.c were set .cpp.

this is what the developers need.

I have given the advice times.

yujin
Associate II

let me clarify my questions again.

i want to develope with C++.

and STM32cubeide has the option to use c++ as major user developing language.

user's c++ code will mixed with c in main.c and stm32f3xx_it.c. but this want work unless main.c and stm32f3xx_it.c 's suffix name change to .cpp.

gbm
Lead III

For the ISRs in stm32fxxx_it.c to work correctly, it's necessary to declare them as C functions. Same for some components of main.c. It's easier to keep these files as C rather than C++.

yujin
Associate II

if so,how to use c++?

gbm
Lead III

in a C++ module, declare a single function to be called by main as extern "C", this funcion will provide the interfce between main() and C++ code. It will call the other C++ stuff. Do the same for interrupts handled in C++.

yujin
Associate II

how would you use c++ class in the main.c file?

yujin
Associate II

c++ is compatible with c,but c is not with c++.