C++, SDL & SDL_image Link problem [RESOLVED]

Started by
22 comments, last by Al MacInnis 19 years, 10 months ago
I am working on a SDL program, and there are no problems. Yesterday, i included the SDL_image library in order to load PNG, JPG... images in my program. I put the #include <SDL_image.h> as required. Compilation , no problems. Link : Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland Error: Unresolved external '_IMG_Load' referenced from C:\PROGRAMMATION\C++\SDL\SPRITES.OBJ I am using the IMG_load (char *file) function... Where am i wrong ? Did i forgot a file in the linker command line ? Thank you. "Everyday above ground is a good day" (Mel in Scarface) Edited by - Al MacInnis on February 21, 2002 1:22:44 PM [edited by - Al MacInnis on August 16, 2002 12:51:21 PM]
"Everyday above ground is a good day" (Mel in Scarface)
Advertisement
Did you linked SDL_image.lib?
i knew i forgot somthing in the command line, but in the package there are no SDL_image.lib.. i''m going to check on the site..
"Everyday above ground is a good day" (Mel in Scarface)
found it

thanks Pedro
"Everyday above ground is a good day" (Mel in Scarface)

I put zlib.dll libpng1.dll and SDL_image.dll in the Lib directory.
With implib, i created the .lib associated, and i put them in the command line of the linker, i get the same error
"Everyday above ground is a good day" (Mel in Scarface)
Any clue ?

"Everyday above ground is a good day" (Mel in Scarface)
"Everyday above ground is a good day" (Mel in Scarface)
Are we talking about SDL (Simple DirectMedia Layer)? If so, I''ve never seen IMG_load. Do you mean SDL_LoadBMP(const char *file)?? Anyway, you only have to include "SDL.h" to use it and that''s it.
He is using SDL, but with the SDL_image library.

Are you sure you downloaded the right source? I know if you try to compile vc++ libraries with dev-c++ it won''t work. You have to download the mingw32 developer source. To get SDL to compile I have to link with

-lmingw32 -lSDLmain -lSDL

(and then don''t forget to link SDL_image)

Then I just check do not make a console. (I think the flag is -mwindows but i''m not sure)
I am using Borland''s free compilers, and i downloaded (at least i think) the rioght components (for Win32 non VC++, there are no multiple choices )

here is the command line that makes the error :


ilink32 -aa -Tpe -L"c:\Programmation\Compil~1\Lib" %P%N.obj import32.lib SDL_image.lib sdl.lib zlib.lib libpng1.lib c0w32.obj cw32.lib

I added SDL_image.lib zlib.lib, libpng1.lib in the command line, since my programs without SDL_image (which run very fine).

Where is the problem :''( ?

"Everyday above ground is a good day" (Mel in Scarface)
"Everyday above ground is a good day" (Mel in Scarface)
You forgot to link with SDL_main

This topic is closed to new replies.

Advertisement