MvHorssen
MvHorssen

Reputation: 143

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?

Upvotes: 2

Views: 7282

Answers (5)

ram krishna
ram krishna

Reputation: 26

In project->manage->project, items->folders extensions add *.hpp as a c++ file extension and rename header files to *.hpp. That should work.

Upvotes: 0

Emp_Otto
Emp_Otto

Reputation: 1

You must add Options For Target section->C/C++ Section
Misc --cpp Keil C++ Support

Upvotes: 0

hitesh
hitesh

Reputation: 1

under project options c/c++ tab for misc controls use --CPP

it points to cpp compiler

Upvotes: 0

Tension
Tension

Reputation: 21

Use the --cpp to enable compiler support.
I've read armcc user guide, and it supports a subset of c++11.

Add:

I don't think a header file have a language type.
It's used only when it's included by a source file.

Upvotes: 0

Anthony
Anthony

Reputation: 2296

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.

Upvotes: 2

Related Questions