Loading...
 
Skip to main content

System Workbench for STM32


Convert to C++ results in linker error "undefined reference to _exit"

Using a simple CubeMX generated project, the project builds and debugs ok but when I do a Project "Convert to C++", I get a link error "undefined reference to _exit". Converting back to C works ok.

Already answered here: http://www.openstm32.org/forumthread739.

When converting to C++, linker .ld file reference needs to be changed from ${workspace_loc:/${ProjName}/LinkerScript.ld} to ..\STM32F407VGTx_FLASH.ld

This setting is found in Project / right-click menu Properties / node C/C++ Builder / Settings / tab Tool Settings / node MCU G++ Linker / General / field Linker Script (-T).

After this, I could link/debug etc. and I could rename my main.c to main.cpp and link/debug etc.