Thread: SDL_Image with SDL 1.2.8 with dev C++

  1. #1
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428

    SDL_Image with SDL 1.2.8 with dev C++

    I have searched the web and can't find a direct answer. I finished a game and want to cut down on the file space by changing all my .bmps to .gifs but every dev pak for SDL_image I have downloaded creates a runtime error. I have found on the internet this means I am using a SDL_image that is not compatible with my version of SDL. Does anyone here use SDL 1.2.8 and have a SDL_image (and a link to it) that is working? I would appreciate the help. I believe my problem is in the .dlls since the error says "can't find error message in SDL.dll." I spent almost 3 hours trying to figure out the answer before posting since I have asked almost all the most recent questions in this message board. Thank you for you time.

  2. #2
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    Use an appropriate version of SDL_image matching your SDL dll

    So go get the lastest version of both and try again:
    Simple DirectMedia Layer
    http://www.libsdl.org/projects/SDL_image/

    btw don't use gif, use png

  3. #3
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    ok I did that I can make a new file and the SDL_image works fine, but if I try a project that is in a new folder (because there are alot of pictures). It won't work. I copied all the .dlls to the project file is there anything else I need to copy over to get this to work? After I added it to an already exhisting project I got the same error message so I tried making a new file and starting a new project ... same error message. The only way I can get SDL_Image to work is if I have it in the root directory for projects... anyone know how to fix this?

  4. #4
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    Are you including the correct header files and their paths ? Make sure you downloaded the mingw32 developer source from the SDL website, since your using dev c++. You also need to link SDL_image.lib.

    Also, could you describe your error a bit more ?

  5. #5
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    Yes I had all my headers included. Honestly dev c++ is steady glitchy with its linkerers. I have to start a new project and copy and paste the old one over every 30 compiles or so. It just didn't want to work last night. I know I was using the right syntaxx because today I started a new folder and a new project saved all my bmps as pngs, and just copy and pasted the code, put the linkerer i to -lSDL_Image and everything works fine today. No idea as to the actual problem last night. Maybe a problem with me actually keeping the project file open while I installed the SDL_Image. None the less problem fixed thank you for your time, and thank you Tux0r for the links.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I've never had any problems with Dev-C++ messing up its projects. You could try downloading a different version (earlier or later, whatever) if it bothers you. Or make a copy of your project file and when it bombs, restore from the backup.

    About SDL_Image: when you're dealing with SDL libraries, you can usually download the MSVC development libraries and get them to work with Dev-C++. Note that .lib files and .a files are actually exactly the same in recent Windows compilers, so you can just rename one to the other if you need to. (If I recall correctly, Dev-C++, being a gcc-based environment, prefers libraries to be called .a.)

    Also, just out of curiosity, are you able to use int main(int argc, char *argv[]) or do you have to use WinMain()? I was never able to get libSDL_main.a to work with Dev-C++ and have always used WinMain() (which is apparently a bad idea). Anyway, that's probably because I was using Dev-C++ 4.0 with gcc 2.95.something.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    Yes , I believe gcc requires WinMain().
    But you can use int main(int argc, char *argv[]) in Visual Studio.

  8. #8
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    Ohh the glitching doesn't bother me. It just randomly decides its not going to compile a working file anymore. Its easy to fix just start a new project in the same folder copy paste the other source code over, delete the old project and .cpp then compile and everything works fine again. I'm using the newest beta version of dev c++ so thats my guess why its still a little buggy. If I lost the files altogether then I would get mad lol, but its just a 2 minute diversion and if I'm trying to compile I've usually finished my newest task at hand so it doesn't interrupt me mid-problem-solving. And yes int main (int argc, char *argv[]) works in the beta dev c++ in fact it is already in any new file you start as a template.

  9. #9
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    And yes int main (int argc, char *argv[]) works in the beta dev c++ in fact it is already in any new file you start as a template.
    Are you able to use it with SDL ?

  10. #10
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    Yes I have never used anything but that for my main statement, and it has worked great with SDL.

  11. #11
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    Interesting, whenever I used SDL with gcca nd dev c++.
    It never worked with the simple int main.
    It must have been fixed in the newer version.

  12. #12
    Bored Programmer
    Join Date
    Jul 2009
    Location
    Tomball, TX
    Posts
    428
    lol after all the information you have given me spidey. I am glad I could finally let you know something new. Again I appreciate your continued support, and that of this message board.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDL Packs in Dev C++
    By Lesshardtofind in forum C++ Programming
    Replies: 2
    Last Post: 07-10-2009, 03:32 AM
  2. Problems compiling this SDL app
    By Rider in forum C++ Programming
    Replies: 3
    Last Post: 03-27-2007, 12:22 PM
  3. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  4. Attention Dev C++ Sdl Users!
    By Blizzarddog in forum Game Programming
    Replies: 0
    Last Post: 05-11-2003, 02:09 PM
  5. sdl in c++
    By Klinerr1 in forum C++ Programming
    Replies: 8
    Last Post: 07-07-2002, 07:46 AM