Jump to content
  • Advertisement
Sign in to follow this  
lotrfan1405

lesson 1

This topic is 4525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm trying to do the openGl tutorials. But I get the following errors ------ Build started: Project: NeHe OpenGl tutorial, Configuration: Debug Win32 ------ Compiling... Lesson1.cpp c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(74) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(79) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [34]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(86) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [31]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(92) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(96) : error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'const char [7]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(98) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [28]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(134) : error C2440: '=' : cannot convert from 'const char [7]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(138) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [37]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(156) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [94]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(163) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(196) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [7]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(199) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [23]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(228) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [34]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(235) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [35]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(242) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [27]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(249) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [37]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(256) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [41]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(268) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [23]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(345) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [42]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\user\desktop\lotrfan1405\c++\nehe opengl tutorial\nehe opengl tutorial\lesson1.cpp(402) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data Build log was saved at "file://c:\Documents and Settings\user\Desktop\lotrfan1405\C++\NeHe OpenGl tutorial\NeHe OpenGl tutorial\Debug\BuildLog.htm" NeHe OpenGl tutorial - 19 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== And the code won't compile? [Edited by - lotrfan1405 on April 15, 2006 4:34:41 PM]

Share this post


Link to post
Share on other sites
Advertisement
It wants wide strings, but you're passing it normal character arrays.

Project -> Properties -> Configuration Properties -> General -> Character Set

Set that setting to Use Multi-Byte Character Set

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
another thing is to put TEXT( ) around the texts.
"Blablub" -> TEXT("BlaBlub")

this should also solve the problem

Share this post


Link to post
Share on other sites
please don't use TEXT unless absolutely necessary.

use the short version _T("whatever")

and for unicode you can use L"whatever"

Share this post


Link to post
Share on other sites
This bring up a question that I have been trying to understand.
What is the diffrence between doing TEXT("..."), _T("...") and L"..."?
I thought they were the same thing. (?)

Thanks,

Sabrina.

[Edited by - SMcNeil on May 4, 2006 6:55:03 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by nova9
please don't use TEXT unless absolutely necessary.

use the short version _T("whatever")

and for unicode you can use L"whatever"


why??

Cheers
Chris

Share this post


Link to post
Share on other sites
quote
WINDOWS.H defines a macro called TEXT() that will mark string literals as Unicode, depending on whether the UNICODE compile flag is set.

#ifdef UNICODE
#define TEXT(string) L#string
#else
#define TEXT(string) string
#endif // UNICODE
/quote

just because _T("hi") takes up less space.

if you don't need to support windows9x or win9x users without MSLU just use L"hi" for unicode, only.

and if win9x users complain tell them to install MSLU to get unicode support
http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx
(as long as your project has implemented MSLU support)

[Edited by - nova9 on May 5, 2006 6:25:07 PM]

Share this post


Link to post
Share on other sites
so your whole post of "please don't use TEXT unless absolutely necessary." is based on TEXT being 2 characters longer than _T?? Being a lisp programmer I respect your concern for making your code dense:)

Cheers
Chris

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!