SDL image

Nov 24, 2008 at 3:36pm
Hello everyone,

I have asked this before as an anwer in another topic, but I didnt got any answers. I hope I now will :)

I'm learning how to use SDL by this tutorial: http://lazyfoo.net/SDL_tutorials/index.php. My compiler is dev-cpp.

I have downloaded SDL, and it works correctly. Now i have downloaded the SDL image libary, exactly as the tutorial describes. I have downloaded the files, copied the include files to the include map in dev-cpp. The .dll file is in both the bin map of dev-cpp as in the map where i have my project. I have one sourcefile (main.cpp) in my Win32 GUI project. As paramater i have:

-lmingw32 -lSDLmain -lSDL-ISDL_image

I have included SDL_image.h in my sourcefile.
This is the error i get:

cannot find -lSDL-ISDL_image

I have spend about an hour checking or everyting is at the right location, or i made any typos, etc., so that wont be the problem. Does anyone know what i'm doing wrong?
Nov 24, 2008 at 6:41pm
Whats the name of the .lib/.a file your using?
Nov 24, 2008 at 7:04pm
SDL_image.lib
( and SDL_image.dll )
Nov 24, 2008 at 7:43pm
Is that the right spelling or have you misquoted

-ISDL_image <---Check your spelling is that a Capital letter I or lower case letter l you have there.

Nov 24, 2008 at 7:58pm
One point for you, aldo it didnt solve the problem. It should be a lower case l, and it was a capital letter I. I still got the same error. Strange, I tought that in the end I had copied/pasted it all directly from the tutorial.

Parameter:

-lmingw32 -lSDLmain -lSDL-lSDL_image

Error:

cannot find -lSDL-lSDL_image
ld returned 1 exit status
C:\prog\SDL\Makefile.win [Build Error] [events.exe] Error 1
Nov 24, 2008 at 8:05pm
I have plain SDL - I'll download SDL_image and see if i get any further insights.
Nov 24, 2008 at 8:07pm
Great, thanks for the help.
Nov 24, 2008 at 8:17pm
I see a possible problem here - exactly which file did you download?
Nov 24, 2008 at 8:28pm
SDL image-devel-1.2.4.-VC6.zip.

VC... Visual C++ right? I have never really understood what VC exactly is, a whole indivual language, a version of C++ or that it has someting to do with Visual Studio?

Do you think I need the other one? This is what was told me in the tutorial (I had to select my OS and compiler, so i though it would be allright), but I shall try the other one.
Nov 24, 2008 at 9:13pm
It seems the win32 file contains an incomplete version of what is inside the VC6 file, without any .h/.lib/.a files (only .dll). As expected, it doesnt work either (you probably ment the reverse: that I had downloaded the win32 file in the first place, while i should download the VC file).

I'm to tired for this now, I will come back to it tomorrow. Thanks for the help so far.
Nov 24, 2008 at 9:50pm
Does the compiler know the path to the libs (-L option)? Also, I think there should be a space between"-lSDL" and "-lSDL_image".

Visual C++ is Microsoft's C/++ IDE. The compiler is usually referred to as VC++, as well.
Nov 24, 2008 at 11:36pm
There should be a space, and no I:
-lmingw32 -lSDLmain -lSDL -lSDL_image


When you say -lfoo (dash, lowercase 'L', and a library name) you are telling the compiler to link with the named library ('foo').

There is only one windows source, and it is specifically designed for use with Microsoft's compiler (it was compiled with MSVC++), but it can be used by MinGW (Dev-Cpp's default compiler).

Hope this helps.
Nov 25, 2008 at 12:04am
Yeah, downloaded it and got it working ok.

By the way - by default when given a library name like sdl_image without a suffix then mingw will automatically assume sdl_image.a

However the library we are using is sdl_image.lib - so you have to give the lib part as well.
So change to -lsdl_image.lib.

(You don't have to do that for the SDL and SDLmain libraries because they have the .a suffix )

Assuming everthing else is to hand, then it should work.
Last edited on Nov 25, 2008 at 12:15am
Nov 25, 2008 at 9:04pm
It's working! Great, thanks all :)

The problem was in the space. Adding .lib doesnt work (it gives an error, also when i have a space). Thanks for the explanations. Now it does not only work, I also understand wy (about parameters etc.), wich wouldnt be the case if it worked immidiatly, and wich I prefere :). Thanks for your help all.
Topic archived. No new replies allowed.