Texture Mapping

Hi,

I have one Solar System program which is compile and run perfect. Now I copy some code from it to put into my program (code for texture mapping) and for unknown reason is finds me 2 errors

Error 1 ‘fopen’ was declared deprecated

Error 2 ‘auxDIBImageLoadW’ : cannot convert parameter 1 from ‘char *’ to ‘LPCWSTR’

These are not OpenGL problems, but compiler issues.

fopen’ was declared deprecated is caused by Microsoft’s new compiler security warnings.

‘auxDIBImageLoadW’ : cannot convert parameter 1 from ‘char *’ to ‘LPCWSTR’ occurs when you are supplying a standard character string when using the wide character (unicode?) compile mode.

I suggest you ask on a C++ forum for more help.

Althought this is not an OpenGL related question, I will answer it.


You are probably using Visual Studio 2005 or 2008. You problems can be solved by altering project settings.

“Error 1 ‘fopen’ was declared deprecated”

This can be solved by two ways:

  1. From the menu, choose Project->Properties. Select “C/C++” from the left. Select “Advanced”. Type “4996” in the “Disable Specific Warnings” property.

  2. The other way is using “#pragma warning(disable : 4996)” before including <stdio.h>.

“Error 2 ‘auxDIBImageLoadW’ : cannot convert parameter 1 from ‘char *’ to ‘LPCWSTR’”

LPCWSTR is a Windows API type and you are probably using Unicode version of the Windows API. From the Project properties, select “General” and set “Character set” property to “Not set”.


Next time, please ask from C++ forums as this is not OpenGL related. One good place to ask C++ / Windows related questions is http://www.codeproject.com

Oh, and yet another thing is of course to use “fopen_s” instead of fopen. Be aware that fopen_s is a Microsoft specific and not portable.