aki*_*kif 3 c++ linker mfc cstring
我使用CString收到链接器错误,错误是:
error LNK2001: unresolved external symbol "private: static class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > CConfiguration::_campaignFolderPath" (?_campaignFolderPath@CConfiguration@@0V?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@A)
Run Code Online (Sandbox Code Playgroud)
我有一个类定义为:
class CConfiguration
{
private:
static CString _campaignFolderPath;
public:
static void Read();
private:
CConfiguration(void);
~CConfiguration(void);
};
Run Code Online (Sandbox Code Playgroud)
其Read方法定义为:
void CConfiguration::Read()
{
CConfigFile configReader(_T("Config.ini"));
TCHAR temp[1024];
configReader.GetStringValue(_T("Campaigns"), _T("CampaignsFolderPath"), temp);
_campaignFolderPath = temp;
}
Run Code Online (Sandbox Code Playgroud)
有关导致错误的原因的任何线索?我正在使用Visual Studio 2008
你需要实例化字符串,你现在只是声明它是静态的.加:
CString CConfiguration::_campaignFolderPath;
Run Code Online (Sandbox Code Playgroud)
在实现文件中.
| 归档时间: |
|
| 查看次数: |
2346 次 |
| 最近记录: |