🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Lesson 1
Hi there, Ive started your OpenGL lessons (which seem to be great btw :D), but ive come accross an error when i try to compile Lesson 1 written by myself:
error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'
Concerning the line
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
The same error occurs for all the MessageBox calls in the code. The wierd thing is if i load your project in to Visual C++, then copy over my version of Lesson1.cpp and compile it, it works perfectly with no errors at all.
Any idea how to fix it for my project? :(
Compile without Unicode, if you're using VC2005 it's under general project settings (I think).
You could also modify
To
The 'L' tells the compiler to treat your string as wide characters.
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
To
MessageBox(NULL,L"Release Of DC And RC Failed.",L"SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
The 'L' tells the compiler to treat your string as wide characters.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement