Trouble static linking source file with library files

My program is in C and uses SDL statements for graphics. I am using the gcc compiler on a Linux Ubuntu OS. I have learned that the program won’t run on a computer that doesn’t have libSDL2 files installed. I am trying to statically link the libSDL2 files that have the ‘.a’ extention. These are as follows:

libSDL2main.a
libSDL2.a
libSDL2_gfx.a
libSDL2_net.a
libSDL2_ttf.a
libSDL2_image.a
libSDL2_test.a
libSDL2_mixer.a

I think I only need the first three but I’m doing them all because i’m having a problem as follows: I am getting hundreds of UNDEFINED REFERENCE messages from file libSDL2.a like I need some other file where all of these are defined. When I link without libSDL2.a I get UNDEFINED REFERENCE errors for the SDL statements in my program. Can someone here tell me where are all the undefined references located?

Here is an example of the hundreds of messages caused by libSDL2.a:

/usr/lib/i386-linux-gnu/libSDL2.a(SDL_waylandmouse.o): In function CreateCursorFromWlCursor.isra.0': (.text+0x264): undefined reference towl_surface_interface’

TIA. Bill S.

Did you even read my answer to your other thread?
(Why start a new one anyway?)

You need to link against everything from sdl2-config --static-libs.On 04/08/2015 05:59 PM, bilsch01 wrote:

My program is in C and uses SDL statements for graphics. I am using the
gcc compiler on a Linux Ubuntu OS. I have learned that the program won’t
run on a computer that doesn’t have libSDL2 files installed. I am trying
to statically link the libSDL2 files that have the ‘.a’ extention. These
are as follows:

libSDL2main.a
libSDL2.a
libSDL2_gfx.a
libSDL2_net.a
libSDL2_ttf.a
libSDL2_image.a
libSDL2_test.a
libSDL2_mixer.a

I think I only need the first three but I’m doing them all because i’m
having a problem as follows: I am getting hundreds of UNDEFINED
REFERENCE messages from file libSDL2.a like I need some other file where
all of these are defined. When I link without libSDL2.a I get UNDEFINED
REFERENCE errors for the SDL statements in my program. Can someone here
tell me where are all the undefined references located?

Here is an example of the hundreds of messages caused by libSDL2.a:

/usr/lib/i386-linux-gnu/libSDL2.a(SDL_waylandmouse.o): In function
CreateCursorFromWlCursor.isra.0': (.text+0x264): undefined reference towl_surface_interface’

TIA. Bill S.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org