Search code examples
c++keil

Enable C++ support ARMCC compiler


I'm setting up a basic project in Keil (V5). I want to use C++ in my project. I'm using the ARMCC compiler.

I created a simple class CTest. But it seems that my project settings/compiler doesn't support C++. C code compiles well, but the keyword 'class' is not recognized.

screenshot

Build log:

build log

Is there a special setting to enable C++ features?


Solution

  • I just tried to make a project and compiling C++ worked fine. However, it will fail if you try to insert code into a C file. (i.e. with a .c extension.) Make sure your file has a .cpp extension.

    Edit:

    And in your case, a .h is fine, but if it includes C++ definitions you can't include it in .c files.