I’m having problems getting SDL_net to link with my application
using the mingw32 cross compiler on linux. When specifing the
linkage with SDL_net and wsock32 with the ‘-l’ linker option to
g++, I get the following errors:
g++ -Wall -Werror -I/usr/local/cross-tools/i386-mingw32/include -I/usr/local/cross-tools/i386-mingw32/include/SDL -Dmain=SDL_main -I/usr/local//include -I. -I… -DWIN32 -g server.cc -o server -L/usr/local/cross-tools/i386-mingw32/lib -lmingw32 -lSDLmain
-lSDL -luser32 -lgdi32 -lwinmm -ldxguid -mwindows -lSDL_mixer -lSDL_net -lwsock32 -lpng -lopengl32 -lglu32 libserver.a …/util/libutil.a
libserver.a(Server.o): In function _6Serveri': Server.cc:20: undefined reference to
SDLNet_AllocSocketSet’
Server.cc:33: undefined reference to SDLNet_TCP_Open' Server.cc:40: undefined reference to
SDLNet_AddSocket’
etc…
However, when I explicitly link the 2 net libraries mentioned above,
it works. E.g. when I add:
/usr/local/cross-tools/i386-mingw32/lib/libSDL_net.a
/usr/local/cross-tools/i386-mingw32/lib/libwsock32.a
to the compiler arguments.
Is this some sort of subtle order-of-link-parameters problem?
Thanks,
JW–
// John Watson
// Software Engineer – STScI Archive Team