I'm compiling a trivial C++ file Temp.cpp
:
#include <string>
int main() { std::wstring s; }
With the command line:
cl.exe /MD /Iinc\api\crt\stl60 /Iinc\crt /Iinc\api C:\Temp.cpp
/LibPath:lib\wxp\i386 /LibPath:lib\crt\i386
/link /LibPath:lib\wxp\i386 /LibPath:lib\crt\i386
in the WDK 7.1 Windows XP Free Build Environment.
I get link errors like (LNK2019):
unresolved external symbol "__declspec(dllimport) public: __thiscall
std::basic_string<wchar_t,struct std::char_traits<wchar_t>,
class std::allocator<wchar_t> >::~basic_string<wchar_t,
struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >(void)"
(__imp_??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator
@_W@2@@std@@QAE@XZ) referenced in function _main
If I use string
instead of wstring
, it works.
What's the cause of the problem? How can I use wchar_t
-based types in my source file?