PDA

View Full Version : Is C++ STL Library Compatible With <windows.h>?


victorzk
11-11-2005, 08:27 PM
Hi,
Could you please tell me why this code does not work?


#include <windows.h>
#include <string>
using namespace std;

int WINAPI WinMain(HINSTANCE h1, HINSTANCE h2,LPSTR cmdline,int cmdshow)
{
wstring a;
a=L"Hello World!";
MessageBox(0,a,L"",0);
return 0;
}


If I cannot use <string>, what library should I use?
Thanks

aman
11-11-2005, 11:51 PM
You probably don't have _UNICODE Defined.


#define UNICODE
#include <windows.h>
#include <string>
using namespace std;

int WINAPI WinMain(HINSTANCE h1, HINSTANCE h2,LPSTR cmdline,int cmdshow)
{
wstring a;
a=L"Hello World!";
MessageBox(0, a.c_str(), L"", 0);
return 0;
}