c++openglglutglewdevil

why in linux work and in win not?


I'm using glew, glut, opengl and devil lib. In Ubu 13.10 with c++ this line compile but in Visual Studio in Win not! Why? std::string path is a parameter passed into the function. This is the code:

//Load image
ILboolean success = ilLoadImage( path.c_str() );

This is the error:

cannot convert argument 1 from 'const char *' to 'const wchar_t *'

Solution

  • It appears your default setting in Visual Studio is to compile with a wide character set (UNICODE). You can either turn off that flag (compile for ANSI) which will utilize a single byte character set (std::string), or change your existing code to utilize a wide character set (std::wstring).