singleton

R

Ron Eggler

Hi,

I'm trying to define a sinlgeton class but I'm having troubles to get it
compiled, my declaration looks like:

#include "tspthread.h"

#ifndef GPIOCONTROL_H_
#define GPIOCONTROL_H_


class GPIOcontrol: public TSPThread
{
public:
static GPIOcontrol* Instance();

protected:
GPIOcontrol();
virtual ~GPIOcontrol();

private:
/**
* The main thread method
*/
virtual void run();
static GPIOcontrol* pinstance;
};

#endif /*GPIOCONTROL_H_*/

But it doesn't compile on the line "static GPIOcontrol* Instance();" it
tells me "error: candidate is: static GPIOcontrol* GPIOcontrol::Instance()"
and i don't understand what coudl be wrong, any help would be appreciated!

Thanks!
Ron
 
I

Ian Collins

Ron said:
Hi,

I'm trying to define a sinlgeton class but I'm having troubles to get it
compiled, my declaration looks like:

#include "tspthread.h"

#ifndef GPIOCONTROL_H_
#define GPIOCONTROL_H_


class GPIOcontrol: public TSPThread
{
public:
static GPIOcontrol* Instance();

protected:
GPIOcontrol();
virtual ~GPIOcontrol();

private:
/**
* The main thread method
*/
virtual void run();
static GPIOcontrol* pinstance;
};

#endif /*GPIOCONTROL_H_*/

But it doesn't compile on the line "static GPIOcontrol* Instance();" it
tells me "error: candidate is: static GPIOcontrol* GPIOcontrol::Instance()"
and i don't understand what coudl be wrong, any help would be appreciated!
Assuming a sane declaration for TSPThread, there doesn't appear to be
anything wrong with your code.

Post the exact error.
 
R

Ron Eggler

Ian said:
Assuming a sane declaration for TSPThread, there doesn't appear to be
anything wrong with your code.

Post the exact error.

Ian, nevermind, I got it, i had a typo in my implementation and the error
message just confused me since it pointed to the declaration...

Thanks to look at it anyways.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,217
Latest member
IRMNikole

Latest Threads

Top