Defining a class | developer.brewmp.com Defining a class | developer.brewmp.com

Developer

Defining a class

Forums:

I have problems defining a class.
For example

class MyClass : public AEEApplet
{
...

This code is not compiling. WHY?

what is the error message you are getting? Many developers are using C++ without any problem.
ruben

what is the error message you are getting? Many developers are using C++ without any problem.
ruben

You need a ';' after the closing '}'.

You need a ';' after the closing '}'.

There are three errors
1. C2061: syntax error : identifier 'MyClass'
2. C2059: syntax error : ';'
3. C2059: syntax error : ':'
The errors are at line "class MyClass..."
When I'm using C++ should I include something or change any settings?
I saw a C++ sample in BREW 1.1 examples. The example works fine. What's the trick in?

There are three errors
1. C2061: syntax error : identifier 'MyClass'
2. C2059: syntax error : ';'
3. C2059: syntax error : ':'
The errors are at line "class MyClass..."
When I'm using C++ should I include something or change any settings?
I saw a C++ sample in BREW 1.1 examples. The example works fine. What's the trick in?

You'll never guess what was the problem :)
The problem was in file extensions. I was including the *.h file into *.c file
After changing c to cpp everything began working.

You'll never guess what was the problem :)
The problem was in file extensions. I was including the *.h file into *.c file
After changing c to cpp everything began working.

Yes, that makes sense.
The "C" file extension envokes the C-compiler - which, of course, knows nothing about classes - while the "CPP" extension envokes the C++ compiler.

Yes, that makes sense.
The "C" file extension envokes the C-compiler - which, of course, knows nothing about classes - while the "CPP" extension envokes the C++ compiler.