lesson 1

Started by
9 comments, last by chollida1 17 years, 11 months ago
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]
Advertisement
Does anybody know why this is?
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
Thank you so much!
another thing is to put TEXT( ) around the texts.
"Blablub" -> TEXT("BlaBlub")

this should also solve the problem
please don't use TEXT unless absolutely necessary.

use the short version _T("whatever")

and for unicode you can use L"whatever"
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]
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
CheersChris
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]
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
CheersChris

This topic is closed to new replies.

Advertisement