Error on Member Initialization
Allen Williams
anw@csunv.com
Sat Sep 13 00:23:00 GMT 2003
Hello,
I have the following declared:
class RADCOMMGT_API CradComMgt
{
public:
CradComMgt(CLog* Log=NULL);
~CradComMgt();
--- snip ---
};
/***************************************/
In another file I declare this:
extern CLog Log; // <- Note declaration of CLog object
class radApp : public lnDaemon
{
public:
virtual void DaemonInit();
protected:
CradComMgt m_MyServer(&Log); // <- Note initialization
};
/******************************************/
I get this from the compiler:
g++ -o radApp -D_LINUX -L../Libraries -I../Headers
radApp.cpp -lApp -lLog -lSock -lNetDataSvc -lradComMgt -lradCore
In file included from radApp.cpp:16:
radApp.h:24: error: invalid data member initialization
radApp.h:24: error: (use `=' to initialize static data members)
make: *** [radApp] Error 1
Compilation exited abnormally with code 2 at Fri Sep 12 20:04:53
I have Stroustrup's C++ reference manual and Ellis and Stroustrup's C++
Annotated reference, both of which say this should be a valid form to call
the CradComMgt::CradComMgt(CLog *) constructor. What am I doing wrong here?
Thanks in Advance,
anw
More information about the Gcc-help
mailing list