cannot call member function 'void CReg::GetStrValue(const char*,

N

neilsolent

Hi

I get the error in the subject line when I try to call a static member
of my class CReg like this:

CReg::GetStrValue("test", mystring);

This is with g++ (on Solaris as it happens). This is perfectly
allowable in Visual C++ on Windows.

What do I need to do? I don't intend to instantiate the CReg class at
any point in the program

thanks!
 
I

Ian Collins

neilsolent said:
Hi

I get the error in the subject line when I try to call a static member
of my class CReg like this:
Put the error in the body of your post, it's easier to read that way.
CReg::GetStrValue("test", mystring);

This is with g++ (on Solaris as it happens). This is perfectly
allowable in Visual C++ on Windows.

What do I need to do? I don't intend to instantiate the CReg class at
any point in the program
The error implies the member isn't static. Post the declaration.
 
N

neilsolent

Can you post a complete program?  The problem isn't with what you've
shown, although its sounds like g++ doesn't think the member is static.

Jeff - thanks, that did it! I'd just missed off the static keywords in
the header file :-(
Sorry - just porting a program from Windows to UNIX and lacking a bit
of experience
 
A

Andrey Tarasevich

neilsolent said:
Sorry - just porting a program from Windows to UNIX and lacking a bit
of experience

Does this mean that you could call a non-static member function without
an object under Windows?
 
N

neilsolent

Does this mean that you could call a non-static member function without
an object under Windows?

No - only a static one. All's well with the world - just a typo
 

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
474,166
Messages
2,570,907
Members
47,447
Latest member
TamiLai26

Latest Threads

Top