我目前正在與一個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 *
是否正確?