J'ai un chemin à mon dossier défini ainsi:C++ fonction DevIL ilLoadImage - sortie du programme, violation d'accès
const char* GROUND_TEXTURE_FILE = "objects/textures/grass.jpg";
Et est ici la fonction, que j'utilise pour charger l'image:
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
Qu'est-ce qui ne va pas dans mon code? Pourquoi le programme tombe quand ilLoadImage
est appelé? Je pense, que file.c_str()
devrait fonctionner correctement comme un type wchar_t *
ou non? Merci pour la réponse :)
Je suis curieux. Pourquoi utiliser wchar du tout? Que se passe-t-il si vous chargez en utilisant fileName? – Andreas
parce que const char * est incompatible avec const wchar_t * ... mais j'ai compris ... le problème n'est pas là, je n'ai pas initialisé la bibliothèque DevIl en utilisant 'ilInit(); ... mon erreur – user3216673