Please help me to get sdl working under Linux.
Here is the output of running the
suggested diagnostics:
(1) Command “which sdl-config” => /usr/bin/sdl-config
(2) Command “sdl-config --version” => 1.2.7
(3) Command “locate libSDL”
=> /usr/lib/libSDL-1.2.so.0
=> /usr/lib/libSDL_mixer-1.2.so.0
=> /usr/lib/libSDL-1.2.so.0.0.5
=> /usr/lib/libSDL_mixer-1.2.so.0.2.2
=> /usr/lib/libSDL_net-1.2.so.0
=> /usr/lib/libSDL_net-1.2.so.0.0.4
=> /usr/lib/libSDL_image-1.2.so.0
=> /usr/lib/libSDLmain.a
=> /usr/lib/libSDL_image-1.2.so.0.1.1
=> /usr/lib/libSDL.a
=> /usr/lib/libSDL.la
=> /usr/lib/libSDL_mixer.a
=> /usr/lib/libSDL_mixer.la
=> /usr/lib/libSDL_mixer.so
=> /usr/lib/libSDL_net.a
=> /usr/lib/libSDL_net.so
=> /usr/lib/libSDL_image.a
=> /usr/lib/libSDL_image.so
(4) Command “tail config.log” => tail: config.log: No such file or
directory
moreover, doing a search for config.log (via the command
"find / -name config.log" in root mode) results in no
matches found.-----------------------------
Here is the test file that I am trying to
compile and link:
#include <stdlib.h>
#include "SDL.h"
int main()
{
if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "Unable to init SDL: %s\n",
SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
}
Here is my Makefile:
CXXFLAGS=-W -Wall -Wpointer-arith -ffast-math -fomit-frame-pointer
-O1 -fno-implicit-templates
SHELL=/bin/bash
SDL_CFLAGS := $(shell sdl-config --cflags)
SDL_LDFLAGS := $(shell sdl-config --libs)
#CXXFLAGS := $(CXXFLAGS) $(SDL_CFLAGS)
#LIBS := $(LIBS) $(SDL_LIBS)
%.run: %.exe
./$*.exe
t-sdl.o: t-sdl.cc
g++ $(CXXFLAGS) $(SDL_CFLAGS) -c $*.cc
t-sdl.exe: t-sdl.o
g++ $(SDL_LDFLAGS) $^ -o t-sdl.exe
Here is the output of running make t-sdl.exe:
cd /home/davin/sdl/mysdl/
make t-sdl.exe
g++ -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread t-sdl.o -o
t-sdl.exe
t-sdl.o(.text+0xf): In function main': : undefined reference to
SDL_Init’
t-sdl.o(.text+0x1e): In function main': : undefined reference to
SDL_GetError’
t-sdl.o(.text+0x46): In function main': : undefined reference to
SDL_Quit’
collect2: ld returned 1 exit status
make: *** [t-sdl.exe] Error 1
Compilation exited abnormally with code 2 at Thu May 13 13:29:48
Compilation took: 1 second
Please help me to get rid of these linker errors. Note
that when I change the linker command to
g++ $^ -o t-sdl.exe $(SDL_LDFLAGS)
I get many many more errors:
(Here is the start of the error log)
/usr/lib/libSDL.a(SDL_x11video.o)(.text+0x1d): In function
X11_Available': : undefined reference to
XOpenDisplay’
/usr/lib/libSDL.a(SDL_x11video.o)(.text+0x2f): In function
X11_Available': : undefined reference to
XCloseDisplay’
/usr/lib/libSDL.a(SDL_x11video.o)(.text+0x453): In function
`create_aux_windows’:
Mailblocks - A Better Way to Do Email
http://about.mailblocks.com/info