We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
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.