jtjli
asked on
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;
}
-------------------------- ---------- ---------- -------
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;
}
--------------------------
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.