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

Posted on 2006-03-22
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;


Question by:jtjli
    LVL 27

    Assisted Solution

    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.
    LVL 6

    Accepted Solution

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

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

    at the top of your program

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now