5
Ich habe einen Weg zu meiner Datei bekam definiert auf diese Weise:C++ DevIL Funktion ilLoadImage - Beenden des Programms, Zugriffsverletzung
const char* GROUND_TEXTURE_FILE = "objects/textures/grass.jpg";
Und hier ist die Funktion, die ich verwende Bild laden:
bool loadTexImage2D(const string &fileName, GLenum target) {
...
// this will load image data to the currently bound image
// at first, we must convert fileName, for ascii, this method is fine?
wstring file(fileName.begin(), fileName.end());
if(ilLoadImage(file.c_str()) == IL_FALSE) { //here the program falls
Was ist falsch in meinem Code? Warum fällt das Programm, wenn aufgerufen wird? Ich denke, dass file.c_str()
sollte gut funktionieren als wchar_t *
Art oder nicht? Vielen Dank für die Antwort :)
Ich bin gespannt. Warum überhaupt wchar? Was passiert, wenn Sie mit Dateiname laden? – Andreas
weil const char * ist nicht kompatibel mit const wchar_t * ... aber ich habe es herausgefunden ... das Problem ist nicht hier, ich habe nicht DevIl-Bibliothek mit 'ilInit() ;; – user3216673