Jump to content
  • Advertisement
Sign in to follow this  
Orrill

My first OpenGL program - problems.

This topic is 4251 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've been following the first of the openGL tutorials from the NeHe website but i'm having trouble getting it to compile and run, the compile errors im getting are all very similar and look like this, 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 there's 19 of them. Are these errors related to using the glaux.h header file or something totally different? also, on NeHe's website there's a note that reads, NOTE #2: When the first tutorials were written, GLAUX was the way to go. Over time GLAUX lost support. Many of the tutorials on this site still use the old GLAUX code. If your compiler does not support GLAUX or you would rather not use it, download the GLAUX REPLACEMENT CODE from the main page (left menu). I have the glaux header installed so I assumed it should work, but if this header is old and out of date then what are the latest headers, SDK, library etc that people are using, there seems to be so many it gets a little confusing. Any extra help would be greatly appreciated. Thanks, Gareth.

Share this post


Link to post
Share on other sites
Advertisement
It's an error with the parameter you're passing to MessageBoxW: sounds like it's related to the win32 api. I'm afraid I can't help you with win32 - you might try looking in a win32 reference and seeing what parameters your function takes and reinterpret_casting your parameter.

I personally don't think the old nehe tutorials are very good for beginners due to reliance on deprecated headers and the fact that win32 is a mess to introduce. I suggest that you look into using SDL or GLFW. Of the two, I prefer GLFW due to its small size, speed, and simplicity. The tutorials on the GLFW site will get you up to speed in no time, are very simple, and very coherent.

Share this post


Link to post
Share on other sites
Quote:
Original post by Orrill
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

there's 19 of them.

Are these errors related to using the glaux.h header file or something totally different?


That error is likely to be because the character set is Unicode, which makes plain char arrays and LPCWSTR incompatible. Are you using Visual C++ 2005 by any chance? I got that error in my old programs when I switched to Visual C++ 2005, which all of a sudden used Unicode as default [grin]

You can do like this in your project: open menu "Project", select Properties, select Configuration Properties, select General, look in the table to the right for "Character Set" and change it from "Use Unicode Character Set" to "Use Multi-Byte Character Set".

It's also possible to use the _T macro to make the code portable between Unicode and Multi-Byte settings, see this article: Generic-Text Mappings in TCHAR.H

Share this post


Link to post
Share on other sites
Thanks for the info guys... Dim_Yimma_H, worked a treat, I also notice that by simply having the character code set to 'not set' also works.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!