Chunky by FelipeFS
Chunky by FelipeFS
GPWiki.org
It is currently Tue Sep 16, 2014 5:26 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: SDL image path uncorrect
PostPosted: Wed Feb 20, 2013 3:24 am 
Rookie

Joined: Wed Feb 20, 2013 3:10 am
Posts: 3
Just starting up with SDL.
I am using Visual Studio, project builds and links fine.
My problem is when I try to load an image i get null pointer back (presumably bad path string)

I tried to put img in different locations, tried absolute and relative paths, made sure no blah.png.png issues.

Am I missing an resource include (I am pretty certain its VS 'feature')?

Any good tutorial on the 'VS resource' and how to manage it.


Top
 Profile  
 
PostPosted: Wed Feb 20, 2013 3:36 pm 
Bytewise
User avatar

Joined: Sun Aug 05, 2012 9:32 pm
Posts: 266
could you perhaps post a piece of the code responsible for loading the image and where the error is thrown, and make sure if you're using PNGs that you have the libpng15-15.dll (thats what's my called) or other used filetypes libraries included next to your compiled executable file

_________________
Did you ever wonder, how time works?


Top
 Profile  
 
PostPosted: Wed Feb 20, 2013 4:46 pm 
Double Guru
User avatar

Joined: Fri Aug 12, 2005 8:58 am
Posts: 2009
Location: LA, CA
In visual studio you will need to set your working directory to where you have your images. You should also use relative paths. Right click on your project in the solution explorer and select properties and the working directory is under Configuration Properties -> Debugging -> Working Directory. By default the project runs in the project folder then under Debug or Release folders.

_________________
My Development Blog | My Website | My Current 3d Engine


Top
 Profile  
 
PostPosted: Wed Feb 20, 2013 9:42 pm 
Grand Optimizer

Joined: Sun Oct 16, 2011 3:09 pm
Posts: 364
Location: Here (where else?)
Another common mistake is to forget to double the \ in path strings.

_________________
My project: Messing about in FreeRCT, dev blog, and IRC #freerct at oftc.net


Top
 Profile  
 
PostPosted: Fri Feb 22, 2013 3:25 pm 
Rookie

Joined: Wed Feb 20, 2013 3:10 am
Posts: 3
so it seems that I had a problem only with loading only png files.

Console output: Couldn't load ./bitmaps/test2.png:Failed loading libpng15-15.dll

However I have that in my sdl_image directory. Does all dll's need to go to the build directory like SDL.dll or SDL_image.dll?
If so maybe there is some cleaner solution to this?


Top
 Profile  
 
PostPosted: Fri Feb 22, 2013 4:44 pm 
Double Guru
User avatar

Joined: Fri Aug 12, 2005 8:58 am
Posts: 2009
Location: LA, CA
All the dlls need to be in your working directory.

_________________
My Development Blog | My Website | My Current 3d Engine


Top
 Profile  
 
PostPosted: Fri Feb 22, 2013 8:56 pm 
Rookie

Joined: Wed Feb 20, 2013 3:10 am
Posts: 3
Seoushi wrote:
All the dlls need to be in your working directory.


including libpng15-15.dll in working directory gave me another error complaining about another dlls.
So included all dlls from SDL_image lib directory.

However that is a lot of dlls and king of messy. Is that a correct solution? (I am just very pedantic :/ )


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group