Sign in to follow this  
lotrfan1405

lesson 1

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
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
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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this