|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- class ConfigParser
- {
- private:
- ConfigParser(void);
- static ConfigParser* m_self; //自己的唯一地址
- public:
-
- //获得单例
- static ConfigParser * instance()
- {
- if (m_self == NULL)//问题出现在这里
- {
- m_self = new ConfigParser();
- /* code */
- }
- return m_self;
- }
复制代码
用g++编译的时候总是提示我
confparser.h:23: undefined reference to `ConfigParser::m_self'
confparser.h:25: undefined reference to `ConfigParser::ConfigParser()'
confparser.h:25: undefined reference to `ConfigParser::m_self'
confparser.h:29: undefined reference to `ConfigParser::m_self'
问题是我在VS上面测试通过了,但是在g++上面就出现这种问题,请问是哪里有问题了,.h和.cpp都放在了一个文件夹中,在线求解答!!!
|
|