For some time I have been struggling with compilation of C++ code for the STM32F4-DISCOVERY development kit - finally, it works. Here are some tips on preparing your own C++ project in CoIDE (version 1.7.0):
- Include from repository the following components: C Library, M4 CMSIS Core, CMSIS Boot, and whatever else your application needs
- In linker settings add the stdc++ and supc++ libraries, but be careful to select the 'right' version. In my case the full path to those files was C:\Program Files (x86)\arm-none-eabi-gcc-4_6\arm-none-eabi\lib\armv7-m (notice the last directory on path)
- Do not rename files from .c to .cpp using F2 - it will not rename them on disk. Instead remove the files from project, rename them manually and add again.
- With current CooCox and arm-none-eabi-gcc-4_6 compiler you do not have to write a single line of code more (especially, do not need to rewrite the 'new' operator nor modify the linker script, you also do not need to modify the project file - .cpp sources will be properly recognized by default)
Selecting the wrong version of libraries results in rising an exception during allocation of memory using the 'new' operator. In case you receive the "undefined reference to 'assert_param'" error, add the 'USE_STDPERIPH_DRIVER' to the 'Defined Symbols' list in project configuration.
My example project with abstract class, virtual methods and memory allocation with 'new' operator is available here: STM32F4 C++ example.