SDL newbie can't get started

Hi,

   I'm a novice programmer ( and a linux newbie )

and i’ve just installed SDL 1.2.5 on my PC ( redhat
8.0, kernel 2.4.18-14 ). I tried compiling a sample
program on test ( testvidinfo.c ) and here’s what
gcc
( or ld ) has to say:

/tmp/ccINqHhj.o: In function RunBlitTests': /tmp/ccINqHhj.o(.text+0x137): undefined reference toSDL_UpperBlit’
/tmp/ccINqHhj.o(.text+0x14c): undefined reference to
SDL_Flip' /tmp/ccINqHhj.o: In functionRunModeTests’:
/tmp/ccINqHhj.o(.text+0x171): undefined reference to
SDL_PollEvent' /tmp/ccINqHhj.o(.text+0x1a1): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x1eb): undefined reference to
SDL_MapRGB' /tmp/ccINqHhj.o(.text+0x1f9): undefined reference toSDL_FillRect’
/tmp/ccINqHhj.o(.text+0x207): undefined reference to
SDL_Flip' /tmp/ccINqHhj.o(.text+0x256): undefined reference toSDL_MapRGB’
/tmp/ccINqHhj.o(.text+0x264): undefined reference to
SDL_FillRect' /tmp/ccINqHhj.o(.text+0x272): undefined reference toSDL_Flip’
/tmp/ccINqHhj.o(.text+0x2c1): undefined reference to
SDL_MapRGB' /tmp/ccINqHhj.o(.text+0x2cf): undefined reference toSDL_FillRect’
/tmp/ccINqHhj.o(.text+0x2dd): undefined reference to
SDL_Flip' /tmp/ccINqHhj.o(.text+0x2f1): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x381): undefined reference to
SDL_PollEvent' /tmp/ccINqHhj.o(.text+0x3b3): undefined reference toSDL_RWFromFile’
/tmp/ccINqHhj.o(.text+0x3bc): undefined reference to
SDL_LoadBMP_RW' /tmp/ccINqHhj.o(.text+0x3d3): undefined reference toSDL_GetError’
/tmp/ccINqHhj.o(.text+0x439): undefined reference to
SDL_GetTicks' /tmp/ccINqHhj.o(.text+0x457): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x506): undefined reference to
SDL_DisplayFormat' /tmp/ccINqHhj.o(.text+0x517): undefined reference toSDL_FreeSurface’
/tmp/ccINqHhj.o(.text+0x52b): undefined reference to
SDL_GetError' /tmp/ccINqHhj.o(.text+0x591): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x5af): undefined reference to
SDL_GetTicks' /tmp/ccINqHhj.o(.text+0x658): undefined reference toSDL_FreeSurface’
/tmp/ccINqHhj.o(.text+0x667): undefined reference to
SDL_PollEvent' /tmp/ccINqHhj.o: In functionRunVideoTests’:
/tmp/ccINqHhj.o(.text+0x6a4): undefined reference to
SDL_WM_SetCaption' /tmp/ccINqHhj.o(.text+0x6b1): undefined reference toSDL_ShowCursor’
/tmp/ccINqHhj.o(.text+0x795): undefined reference to
SDL_SetVideoMode' /tmp/ccINqHhj.o(.text+0x7ac): undefined reference toSDL_GetError’
/tmp/ccINqHhj.o: In function main': /tmp/ccINqHhj.o(.text+0x84f): undefined reference toSDL_Init’
/tmp/ccINqHhj.o(.text+0x861): undefined reference to
SDL_GetError' /tmp/ccINqHhj.o(.text+0x896): undefined reference toSDL_VideoDriverName’
/tmp/ccINqHhj.o(.text+0x8b9): undefined reference to
SDL_GetVideoInfo' /tmp/ccINqHhj.o(.text+0x93c): undefined reference toSDL_ListModes’
/tmp/ccINqHhj.o(.text+0xb50): undefined reference to
`SDL_Quit’
collect2: ld returned 1 exit status

I looked on the FAQs and howtos on libsdl.org but i
didn’t find any related literature for this kind of
situation. I was hoping now that you guys can me
help
on this “itsy-bitsy” problem i can’t manage =)

TIA
charkee__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

You really have to include the command you’re using to compile, though I
suspect you’re just not including SDL correctly.

Try setting up your compile line like this:

gcc sdl-config --cflags mysource.c -o mysource sdl-config --libs

If you’re new to Linux, the (that’s the backward quote, to the left
of 1 on the keyboard) will return the output of the program placed
between them as text straight onto the command line. If you run
sdl-config right on the prompt on its own:

[stuff at place]$ sdl_config --cflags
-I/usr/include/SDL -D_REENTRANT

You’ll see that the config tells the compiler all the correct flags it
needs. In you case, the stuff you’re really missing is what sdl-config
–libs gives you. That’s the libraries it must link with to provide the
objects the compiler’s complaining about.

I hope this helps. In the future you should really include more details
about the specifics.

Good luck.On Thu, 2003-06-19 at 08:29, charkee berekeke wrote:

Hi,

   I'm a novice programmer ( and a linux newbie )

and i’ve just installed SDL 1.2.5 on my PC ( redhat
8.0, kernel 2.4.18-14 ). I tried compiling a sample
program on test ( testvidinfo.c ) and here’s what
gcc
( or ld ) has to say:

/tmp/ccINqHhj.o: In function RunBlitTests': /tmp/ccINqHhj.o(.text+0x137): undefined reference toSDL_UpperBlit’
/tmp/ccINqHhj.o(.text+0x14c): undefined reference to
SDL_Flip' /tmp/ccINqHhj.o: In functionRunModeTests’:
/tmp/ccINqHhj.o(.text+0x171): undefined reference to
SDL_PollEvent' /tmp/ccINqHhj.o(.text+0x1a1): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x1eb): undefined reference to
SDL_MapRGB' /tmp/ccINqHhj.o(.text+0x1f9): undefined reference toSDL_FillRect’
/tmp/ccINqHhj.o(.text+0x207): undefined reference to
SDL_Flip' /tmp/ccINqHhj.o(.text+0x256): undefined reference toSDL_MapRGB’
/tmp/ccINqHhj.o(.text+0x264): undefined reference to
SDL_FillRect' /tmp/ccINqHhj.o(.text+0x272): undefined reference toSDL_Flip’
/tmp/ccINqHhj.o(.text+0x2c1): undefined reference to
SDL_MapRGB' /tmp/ccINqHhj.o(.text+0x2cf): undefined reference toSDL_FillRect’
/tmp/ccINqHhj.o(.text+0x2dd): undefined reference to
SDL_Flip' /tmp/ccINqHhj.o(.text+0x2f1): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x381): undefined reference to
SDL_PollEvent' /tmp/ccINqHhj.o(.text+0x3b3): undefined reference toSDL_RWFromFile’
/tmp/ccINqHhj.o(.text+0x3bc): undefined reference to
SDL_LoadBMP_RW' /tmp/ccINqHhj.o(.text+0x3d3): undefined reference toSDL_GetError’
/tmp/ccINqHhj.o(.text+0x439): undefined reference to
SDL_GetTicks' /tmp/ccINqHhj.o(.text+0x457): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x506): undefined reference to
SDL_DisplayFormat' /tmp/ccINqHhj.o(.text+0x517): undefined reference toSDL_FreeSurface’
/tmp/ccINqHhj.o(.text+0x52b): undefined reference to
SDL_GetError' /tmp/ccINqHhj.o(.text+0x591): undefined reference toSDL_GetTicks’
/tmp/ccINqHhj.o(.text+0x5af): undefined reference to
SDL_GetTicks' /tmp/ccINqHhj.o(.text+0x658): undefined reference toSDL_FreeSurface’
/tmp/ccINqHhj.o(.text+0x667): undefined reference to
SDL_PollEvent' /tmp/ccINqHhj.o: In functionRunVideoTests’:
/tmp/ccINqHhj.o(.text+0x6a4): undefined reference to
SDL_WM_SetCaption' /tmp/ccINqHhj.o(.text+0x6b1): undefined reference toSDL_ShowCursor’
/tmp/ccINqHhj.o(.text+0x795): undefined reference to
SDL_SetVideoMode' /tmp/ccINqHhj.o(.text+0x7ac): undefined reference toSDL_GetError’
/tmp/ccINqHhj.o: In function main': /tmp/ccINqHhj.o(.text+0x84f): undefined reference toSDL_Init’
/tmp/ccINqHhj.o(.text+0x861): undefined reference to
SDL_GetError' /tmp/ccINqHhj.o(.text+0x896): undefined reference toSDL_VideoDriverName’
/tmp/ccINqHhj.o(.text+0x8b9): undefined reference to
SDL_GetVideoInfo' /tmp/ccINqHhj.o(.text+0x93c): undefined reference toSDL_ListModes’
/tmp/ccINqHhj.o(.text+0xb50): undefined reference to
`SDL_Quit’
collect2: ld returned 1 exit status

I looked on the FAQs and howtos on libsdl.org but i
didn’t find any related literature for this kind of
situation. I was hoping now that you guys can me
help
on this “itsy-bitsy” problem i can’t manage =)

TIA
charkee


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Jimmy <@Jimmy>
Jimmy’s World.org
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030619/da19efe5/attachment.pgp

   I'm a novice programmer ( and a linux newbie )

and i’ve just installed SDL 1.2.5 on my PC ( redhat
8.0, kernel 2.4.18-14 ). I tried compiling a sample
program on test ( testvidinfo.c ) and here’s what
gcc
( or ld ) has to say:

/tmp/ccINqHhj.o: In function RunBlitTests':SDL_ListModes’

/tmp/ccINqHhj.o(.text+0xb50): undefined reference to
`SDL_Quit’
collect2: ld returned 1 exit status

What commands are you using to compule, it should read something like:
gcc file.c -o file sdl-config --cflags --libs

the last thing is to let the compiler now where the libraries and such that it needs are located (which could explain why the linker can’t find those SDL functions.–
Thomas M?lhave
"I’ve never let my schooling interfere with my education." -Mark Twain

Thanks a lot guys, your advice worked. Really
appreciate the help =)

Message: 6Subject: Re: [SDL] SDL newbie can’t get started
From: jimmy@jimmysworld.org (Jimmy)
To: SDL Mailing List
Organization: Jimmy’s World.org
Date: 19 Jun 2003 11:05:50 -0400
Reply-To: sdl at libsdl.org

You really have to include the command you’re using to
compile, though
I
suspect you’re just not including SDL correctly.

Try setting up your compile line like this:

gcc sdl-config --cflags mysource.c -o mysource
sdl-config --libs

If you’re new to Linux, the (that’s the backward
quote, to the
left
of 1 on the keyboard) will return the output of the
program placed
between them as text straight onto the command line.
If you run
sdl-config right on the prompt on its own:

[stuff at place]$ sdl_config --cflags
-I/usr/include/SDL -D_REENTRANT

You’ll see that the config tells the compiler all the
correct flags it
needs. In you case, the stuff you’re really missing
is what sdl-config
–libs gives you. That’s the libraries it must link
with to provide
the
objects the compiler’s complaining about.

I hope this helps. In the future you should really
include more
details
about the specifics.

Good luck.


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com