?
Solved

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

Posted on 2006-03-22
2
Medium Priority
?
919 Views
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!

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;
}

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

0
Comment
Question by:jtjli
2 Comments
 
LVL 27

Assisted Solution

by:Nopius
Nopius earned 1000 total points
ID: 16266173
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
 
LVL 6

Accepted Solution

by:
enwhysee earned 1000 total points
ID: 16267550
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline

840 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