Sign in to follow this  
vurentjie

setting up libsdl

Recommended Posts

ok, after spending some time with glut and getting used to opengl functions, i am making a decision to switch to sdl, it just feels right in my gut, i am still not clued up on what to do with the sdl source code, i.e. do i need to compile a .dll or .lib file with it? and if so how do i do that on my windows XP machine, another thing that might save time....i first downloaded the libsdl source code, after that i downloaded the sd.dll file (which i am assuming goes into my windows/system folder), but i am now stuck with this and the source code which has a lot of different files, what do i include, where do i copy the sdl header files, and how do i get(build?) a .lib file, if this makes sense to anyone, your advice would be appreciated by the way i am using code::blocks...if that helps.

Share this post


Link to post
Share on other sites
ok wait, i just realize libsdl-dev, is the precompiled, i thought for some reason it was a package for those interested in developing upon sdl code(which it is), but little did he know, and i

Share this post


Link to post
Share on other sites
ok so i have put all the folders in their places,
.lib to Mingw/lib
SDL to Mingw/include

and i put .dll in my windows system

now i create a new sdl project with wizard and it asks me to locate the links on my pc,

it first asks to locate where SDL is on my pc so i say F:/code::blocks/mingw

or i try F:/code::blocks/mingw/include

or i try F:/code::blocks/

but it tells me cannot find sdl.h, but i can see it in that folder definitely,


how do i manually link up?

Share this post


Link to post
Share on other sites
Quote:
do i need to compile a .dll or .lib file with it?
Yes. If you compile the library as a dynamic library, you get a dll, which you need at runtime, and a corresponding import library for linking to the dll. You can also compile the library as a static library, which then gets you a lib file.

Quote:
and if so how do i do that on my windows XP machine,
Read the instructions. Libraries usually distribute along with their code, README and INSTALL files, or documentation files. Reading them is not optional. For example, in the SDL library, there is an INSTALL file telling you precisely what to do. It actually links to a FAQ page for SDL. There's very good directions for building SDL, you just need to read them.

Truthfully, sometimes the directions aren't explicitly given. You should be familiar with the configure/make system. It is used in SDL, although the directions assume no knowledge of it. Sometimes, it's not even that much, and you have to extrapolate from sparse documentation. Neither is the case here.

Quote:
i first downloaded the libsdl source code, after that i downloaded the sd.dll file
It's just the runtime. I don't think they ship the import libraries as well, so you still have to build SDL.

Read the documentation. I can't stress this enough.

Share this post


Link to post
Share on other sites
ok so i did some homework,

i set my linking options for sdl in code::blocks with

winmm
gdi32
dxguid


and then i try to build but it gives me a strange error

undefined reeference to Winmain@16

so i go look some more and find on libsdl.org

need to add following links

SDLmain
SDL
mingw32

and mwindows

so i do that and compile then i get cannot find mwindows
so i search my pc for that file but nothing

so now i need to find it, is it part Mingw package? would i just need to download that in order to get it?

Share this post


Link to post
Share on other sites
funny story, the only way i could figure this out was whack!

eventually i did this i reinstalled DevC that i have just moved from in favour of Code::Blocks, then i ran the sdldevpak, then i opened a SDL template in DevC and checked those linker options which were

-lmingw32
-lSDLmain
-lSDL
-lopengl32

so used thos in code::blocks linking options as

mingw32
SDLmain
SDL
opengl32

and glory hallelujah, it built, two hours later
this is here for anyone new to SDL that has to go through the same process

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this