'identifier' is private within this context

Kevin Hise kevinh@ridgenet.net
Wed Jan 16 23:35:00 GMT 2002


I'm attempting to access a static variable from a static method, both members 
of the same class, both declared 'private', but declaring the variable and 
the method anything other than 'public' will cause g++ to barf a message 
saying the variable, function, or whatever is private / protected "within 
this context", like so:

rapi.cpp:296: `static int RAPI::GetHostAddr(uint32_t *, const char *)' is 
private
rapi.cpp:437: within this context
rapi.h:271: `enum RAPI::SUSPEND_TYPE RAPI::SUSPEND_ENTER' is private
rapi.cpp:441: within this context
rapi.cpp:447: `sockList' undeclared (first use this function)
rapi.cpp:447: (Each undeclared identifier is reported only once
rapi.cpp:447: for each function it appears in.)
rapi.cpp:339: `static int RAPI::SocketOpen(unsigned int, unsigned int)' is 
private
rapi.cpp:458: within this context
rapi.h:263: `static struct RAPI::SockItem * RAPI::AddConnection(int, unsigned 
int, unsigned int, RAPI::SockItem::SOCKTYPE)' is private
rapi.cpp:468: within this context
rapi.cpp:411: `static void RAPI::SocketClose(int)' is private
rapi.cpp:473: within this context
rapi.h:272: `enum RAPI::SUSPEND_TYPE RAPI::SUSPEND_LEAVE' is private
rapi.cpp:490: within this context
rapi.cpp: In function `struct RAPI::SockItem * AddConnection(int, unsigned 
int, unsigned int, RAPI::SockItem::SOCKTYPE)':
rapi.cpp:22: `struct RAPI::SockItem * RAPI::sockList' is private
rapi.cpp:581: within this context
rapi.cpp:22: `struct RAPI::SockItem * RAPI::sockList' is private
rapi.cpp:582: within this context
make: *** [rapi.o] Error 1

What do I do?  Do I have to have all of my class members public now?

Scratching my head in the desert...
kevinh



More information about the Gcc-help mailing list