Skip to main content
GameDev.net gamedev.net
🔒 Locked

DevIL Load image

Started by BloodLust666 Jan 31, 2006 at 11:03 PM 4 replies 950+ views
Original Post
BloodLust666
BloodLust666
Load(std::string Filename) { // ... bool success = ilLoadImage((const ILstring)Filename.c_str()); // ... return true; } at that line, the program fails and says: "An unhandled exception of type 'System.NullReferenceException' occurred in Drawing.exe Additional information: Object reference not set to an instance of an object." what's this mean?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Rob Loach
Rob Loach
bool success = ilLoadImage(Filename.c_str());
... doesn't work?

Also, it should be something like:
if(ilLoadImage(Filename.c_str()) == IL_FALSE){   // Failure!}else{   // Success!}
Rob Loach [Website] [Projects] [
BloodLust666
BloodLust666
alright i'll try that, but no.. it's not working.. i'm getting a fatal error at that line that says what i have in the first post
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
BloodLust666
BloodLust666
what's weird about it is i worked once, then i left it alone for the day (i keep my computer on and VS.net 2003 was still open), then i came back to it and it gave that error; i didn't change anything...
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Rob Loach
Rob Loach
If you try it with a different compiler do you get the same result?
Rob Loach [Website] [Projects] [
Horatius83
Horatius83
If you're using VS 2005 remember that ILstring is a typedef for wchar_t*. You might check to see if your compiler has UNICODE defined or not. Also you might want to do a check like
if(Filename.data()) or if(Filename.size()) to make sure there is data in the string since it appears you have a null pointer somewhere.

You might also try passing the string by reference, at the very least you get a performance gain by just passing a 32bit pointer rather then creating an entirely new string.

hope this helps...
"Think you Disco Duck, think!" Professor Farnsworth

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.