We help IT Professionals succeed at work.

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

jtjli asked
Medium Priority
Last Modified: 2008-03-17
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!

#ifndef __COUNTER_H__
#define __COUNTER_H__

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

#endif //__COUNTER_H__

#include "counter.h"

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

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


Watch Question

Artysystem administrator
Top Expert 2007
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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
As Nopius mentions, you'd need to include some header files. Try:

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

at the top of your program
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.