This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

c++ header file for "Class"

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

Parents
  • 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.

Reply
  • 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.

Children
No data