我目前正在与一个wxWidgets的项目的工作,我有一个wxString复制到一个静态的C字符串,可以用来存放程序的生命周期价值。基本上我的头文件和源文件看起来像这样:如何使用静态字符
*****************PortDialog.h*****************
...
static char *portName;
-----------------------end
和源文件是;
***************PortDialog.cpp*****************
.
.
.
wxString str = "COM1";
strcpy(portName, (const char*)str.mbc_str());
---------------------end
但是我遇到以下链接错误。
error LNK2001: unresolved external symbol "public: static char * portDialog::eportName" ([email protected]@@2PADA)
有人可以向我解释我在这里犯的是什么错误?上述目的使用static char *
是否正确?