Jump to content

  • Log In with Google      Sign In   
  • Create Account

lesson 6 compile error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 andi1234   Members   -  Reputation: 100

Like
0Likes
Like

Posted 30 June 2011 - 06:39 AM

Hello
I'm new to openGL and I've just tried lesson 6, but I get this error:

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

in this line:

AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle
if (!Filename) // Make Sure A Filename Was Given
{
return NULL; // If Not Return NULL
}
File=fopen(Filename,"r"); // Check To See If The File Exists
if (File) // Does The File Exist?
{
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer
}

return NULL; // If Load Failed Return NULL
}

I'm using VS 2008

thanks

Sponsor:

#2 GRascm   Members   -  Reputation: 100

Like
0Likes
Like

Posted 23 July 2011 - 09:45 AM

Replace this line with

return auxDIBImageLoadA(Filename); // Load The Bitmap And Return A Pointer

#3 AaronL   Members   -  Reputation: 100

Like
0Likes
Like

Posted 01 August 2011 - 09:31 AM

You are compiling using the Unicode character set. There are two fixes for this. First, go to your project properties. Under Configuration Properties-->General, change Character Set to use Multi Byte Character set. Then you can do the tutorials unchanged.

I prefer a second fix. Leave your code as Unicode. Change all string literals as follows: Instead of a string like "Nehe OpenGL" it should be (LPWCSTR)L"Nehe OpenGL". All Java, C#, etc. code is always Unicode, and it's good to follow this pattern in C++ too because it's better if you wanted to internationalize your code later on.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS