C++ QRCodeSignature类不允许记录语句

C++ QRCodeSignature类不允许记录语句,c++,compiler-errors,linker-errors,qr-code,C++,Compiler Errors,Linker Errors,Qr Code,我有一个QRCode签名类,我希望将日志语句放在其中,我从构造函数部分开始,如下所示: QRCodeSignature::QRCodeSignature(std::vector<WacomType::PEN>* theSigpoints, int theInterval, int theVersion) : sigpoints(theSigpoints), interval(theInterval), version(theVersion) { Logging::log(QRCode

我有一个QRCode签名类,我希望将日志语句放在其中,我从构造函数部分开始,如下所示:

QRCodeSignature::QRCodeSignature(std::vector<WacomType::PEN>* theSigpoints, int theInterval, int theVersion) : sigpoints(theSigpoints), interval(theInterval), version(theVersion) {
Logging::log(QRCodeSignature::logger, Logging::Entry, QRCodeSignature::CLASSNAME, "QRCodeSignature");
在QRCodeSignature.cpp中,我得到了

 const std::string CLASSNAME = "QRCodeSignature";
 Logging::logger* QRCodeSignature::logger = NULL;
生成此项目[版本]时出现的错误

 build/Release/MinGW_1-Windows/QRCodeSignature.o: In function `QRCodeSignature':
 C:\repos\impression\trunk\ProsenseSign/QRCodeSignature.cpp:13: undefined reference to `QRCodeSignature::CLASSNAME'
 collect2: ld returned 1 exit status
 make[2]: *** [dist/Release/MinGW_1-Windows/impression.api] Error 1
 make[1]: *** [.build-conf] Error 2
 make: *** [.build-impl] Error 2
你应该使用

const std::string QRCodeSignature::CLASSNAME = "QRCodeSignature";
而不是

const std::string CLASSNAME = "QRCodeSignature";
因为第二个不是类的
静态成员的初始化

const std::string QRCodeSignature::CLASSNAME = "QRCodeSignature";
const std::string CLASSNAME = "QRCodeSignature";