2009-10-02 2 views
3

내가 오류를 CString을 사용하여 링커 오류를 받고 있어요입니다링크 오류 CString을

class CConfiguration 
{ 
private: 
    static CString _campaignFolderPath; 

public: 
    static void Read(); 

private: 
    CConfiguration(void); 
    ~CConfiguration(void); 
}; 

그 읽기 방법은 다음과 같이 정의된다 :

error LNK2001: unresolved external symbol "private: static class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > CConfiguration::_campaignFolderPath" ([email protected]@@[email protected][email protected][email protected][email protected]@@@@@[email protected]@A) 

I는 다음과 같이 정의 된 클래스가

void CConfiguration::Read() 
{ 
    CConfigFile configReader(_T("Config.ini")); 
    TCHAR temp[1024]; 

    configReader.GetStringValue(_T("Campaigns"), _T("CampaignsFolderPath"), temp); 

    _campaignFolderPath = temp; 
} 

오류의 원인에 대한 단서가 있습니까? Visual Studio 2008을 사용하고 있습니다.

답변

7

문자열을 인스턴스화해야합니다. 이제는 정적으로 선언하는 것입니다. 추가 : 구현 파일에

CString CConfiguration::_campaignFolderPath; 

+0

오류 C2039 : 'CString': 'CConfiguration'의 구성원이 아닙니다. – akif

+0

CString CConfiguration :: _ campaignFolderPath; 감사합니다 – akif

+0

대답을 편집하십시오 제발, 그 오타를 믿지 – akif

3

다음과 같은 구현 라인이 있습니까?

CString CConfiguration :: _ campaignFolderPath;