I have looked for similar problems but none are in the context I require. The odd thing with this is that I get this error yet a different project set out in code the same way seems to work perfectly.
I am trying to load images into textures in openGL and have a function which takes in this parameter:
GLuint loadTexture(LPTSTR szFileName);
I then call it like this:
textureLib[0]= loadTexture("texturelib/texture1.bmp");
textureLib[1]= loadTexture("texturelib/texture2.bmp");
textureLib[2]= loadTexture("texturelib/texture3.bmp");
textureLib[3]= loadTexture("texturelib/texture4.bmp");
it then says "1>e:\usb\uni work\graphics\coursework\coursework\main.cpp(291): error C2664: 'loadTexture' : cannot convert parameter 1 from 'const char [24]' to 'LPTSTR'"
As stated above another program that I have seems to allow it so if there is a way of just fixing it to run it that would be appreciated :)
LPTSTR
is either char*
or wchar_t*
, depending on whether Unicode macros are set (UNICODE
, _UNICODE
). And if you're passing literals to that function, you should not use it (and use LPCTSTR
instead, which is const char/wchar_t*
). After you change the signature, use _T()
or TEXT()
macro to match the literals to the type, i.e.
GLuint loadTexture(LPCTSTR filename);
loadTexture(TEXT("texturelib/texture1.bmp"));