Skip to main content
GameDev.net gamedev.net
🔒 Locked

basic question about lesson 1

Started by GLnoobie Feb 9, 2009 at 1:36 AM 2 replies 15.1k views
Original Post
GLnoobie
GLnoobie
Forgive me if I'm overlooking something very basic, but I'm using Visual C++ 2008 express, and I believe it does not support the glaux library. Anyways I downloaded the replacement code as lesson 1 suggested but now I have no idea what to do with it or how to use it? Any help would be much appreciated.
thecupus
thecupus
hey, i've got a problem with lesson1 too. i use microsoft visual studio 2008 express edition. i've added the required .lib at project>>project properties>>linker>>input>>additional dependencies

but when i 'm trying to compile my code (it is just a copy-paste from the downloaded file to my own project), this error warning show up.


this is for every MessageBox () line,
error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

and this for another error warning,


error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'const char [7]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


but when i'm trying to compile the downloaded file, it works fine!!
am i missing something? i'm still new playing with OpenGL.

i would greatly appreciate any help.
SimonForsman
SimonForsman

hey, i've got a problem with lesson1 too. i use microsoft visual studio 2008 express edition. i've added the required .lib at project>>project properties>>linker>>input>>additional dependencies

but when i 'm trying to compile my code (it is just a copy-paste from the downloaded file to my own project), this error warning show up.


this is for every MessageBox () line,
error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

and this for another error warning,


error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'const char [7]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


but when i'm trying to compile the downloaded file, it works fine!!
am i missing something? i'm still new playing with OpenGL.

i would greatly appreciate any help.


the conversion errors are due to the project using unicode which means the Windows message boxes will expect unicode strings, use wchar_t instead of char and L"some text" instead of "some text" for static strings. (http://unicode.org/standard/WhatIsUnicode.html)

you can also use std::wstring instead of std::string.

The Windows headers should also declare a TEXT macro, so rather than using L"some text" you can use TEXT("some text") and the code will keep working properly regardless of unicode support, for character variables the appropriate macro is TCHAR.

You could also add similar functionality for c++ strings using:
namespace std
{
typedef basic_string tstring;
}

and so on for other streams if needed.

(If you only intend to support modern desktop systems then you can just ignore the conversion macros and just use unicode directly)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.