C++ Newbie -- syntax error : missing ';' before identifier

I'm new to C++... and what i am doing now is to add a very simple class to an existing HelloWorld program (for Symbian..but shouldn't matter i guess?)

However, when i compile, it always says SYNTAX ERROR : MISSING ';' BEFORE IDENTIFIER 'GetCount'.  ... And obviously i'm not missing any semicolon.. please HELP!

counter.h
=================
#ifndef __COUNTER_H__
#define __COUNTER_H__

class Counter {
      public:
            static void Start(void);
            static TInt GetCount(void) const;  // TInt is the int type for Symbian SDK
      private:
            static TInt mycount;
};

#endif //__COUNTER_H__


counter.cpp
==================
#include "counter.h"

void Counter::Start() {
      Counter::mycount = Counter::mycount + 1;
}

TInt Counter::GetCount() const {
  return Counter::mycount;
}

-----------------------------------------------------

jtjliAsked:
Who is Participating?
 
enwhyseeCommented:
As Nopius mentions, you'd need to include some header files. Try:

#include <e32base.h>
#include <e32cons.h>

at the top of your program
0
 
NopiusCommented:
This message comes because you haven't included some Symbian specific header (where type TInt is defined).
Sorry, I don't know exactly which one.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.