Hello,
which spezifications / header files are necessary to use the Realview compiler for c++?
I use
#include<stdlib.h> #include<iostream.h>
Class Array { private: int val[19]; public: int max = 2; };
But µVision don't know the word "Class" - is it the wrong spelling or is there a necessary headerfile missing?
best wishes Tina
are there any settings I have to change for c++? Or is it only possible to use c++ with the whole RealTime MDK?
In which folder can I found the header files for c++?
I haven't tested to compile C++ code with the tool, but what file extension do you have on your source files?
I only get an .c file not an .cpp file.
Are there any settings necessary in the Options for target > c/c++ menue?
I'm not sitting near the tools, but even if it is possible to have c++ code in a *.c file, I don't recommend it. Always use the proper file extension.
that's true - I don't want to have any c code - only c++ code.
But I don't know how I can get a cpp file from uvision. Maybe you can take a look when you are in front of your tools, if there are settings I have to take.
Under settings->extensions the file extension *.cpp will support C++ while the file extension *.c will not support C++. You can mix files or you can change the extension defaults. Bradford
I don't know what you mean by "get a cpp file from uVision".
It should be enough to just create a *.cpp file and add to the project.
ok - I only have to change .c into .cpp - that's all? But what's the problem that uvision gets an error, when I write "class"?
The C++-unique keyword "class" does not exists in C, so uVision should complain, if a statement starts with "class" in a C file.
In C, you can declare a variable named class, i.e.
int class;
In older C compilers, you may declare variables with an implicit int data type, writing:
class;
But you will not manage to get a C compiler to like:
class Array { ... };
since that does not mean anything for a C compiler. If "class" was a function name (with an implicit int return type) then it should be followed by a '(' character for the parameter list. If "class" is a variable (of implicit int type) then it should be followed by a comma, a semicolon, a '[' or similar.