netwalker
01-05-2008, 07:49 PM
Hi All,
As you can see from the title of this thread I'm having a lot of problems compiling a simple SDL application (actually it doesn't do anything!) using the -static switch. Now the environment that I'm using for this is MinGW v3.4 downloaded from here (link). In addition the version of GCC that comes with this distribution is (4.2.1-dw2). I'm not really sure that that information is relevant but I just put it there just in case.
Here is the application that I'm trying to statically compile:
#include <sdl\sdl.h>
int main(int argc, char **argv)
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Quit();
return(0);
}
and here is the command line:
gcc -otest.c test.c -O2 -Wall -s -static -lSDLmain -lSDL -lmingw32
depending on where I place the -static switch I get anything from 1 to many errors. Please note however that when I omit the -static switch the program compiles no problem.
some are listed below.
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libmingw32.a(main.o):main.c:(.text+0xa4): undefined reference to `_WinMain@16'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x40): undefined reference to `_timeKillEvent@4'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x4f): undefined reference to `_timeEndPeriod@4'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x6b): undefined reference to `_timeBeginPeriod@4'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x9e): undefined reference to `_timeSetEvent@20'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x186): undefined reference to `_timeGetTime@0'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x1c5): undefined reference to `_timeBeginPeriod@4'
...
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_wingl.o):SDL_wingl.c:(.text+0xe21) : undefined reference to `_ChoosePixelFormat@8'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_wingl.o):SDL_wingl.c:(.text+0xf09) : undefined reference to `_DescribePixelFormat@16'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5yuv.o):SDL_dx5yuv.c:(.text+0x3a e): undefined reference to `_IID_IDirectDrawSurface3'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5events.o):SDL_dx5events.c:(.tex t+0x17d5): undefined reference to `_IID_IDirectInputDevice2A'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5events.o):SDL_dx5events.c:(.dat a+0x4): undefined reference to `_GUID_SysKeyboard'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5events.o):SDL_dx5events.c:(.dat a+0x1c): undefined reference to `_GUID_SysMouse'
collect2: ld returned 1 exit status
Any help on this is much appreciated.
Thanks,
netwalker.
As you can see from the title of this thread I'm having a lot of problems compiling a simple SDL application (actually it doesn't do anything!) using the -static switch. Now the environment that I'm using for this is MinGW v3.4 downloaded from here (link). In addition the version of GCC that comes with this distribution is (4.2.1-dw2). I'm not really sure that that information is relevant but I just put it there just in case.
Here is the application that I'm trying to statically compile:
#include <sdl\sdl.h>
int main(int argc, char **argv)
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Quit();
return(0);
}
and here is the command line:
gcc -otest.c test.c -O2 -Wall -s -static -lSDLmain -lSDL -lmingw32
depending on where I place the -static switch I get anything from 1 to many errors. Please note however that when I omit the -static switch the program compiles no problem.
some are listed below.
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libmingw32.a(main.o):main.c:(.text+0xa4): undefined reference to `_WinMain@16'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x40): undefined reference to `_timeKillEvent@4'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x4f): undefined reference to `_timeEndPeriod@4'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x6b): undefined reference to `_timeBeginPeriod@4'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x9e): undefined reference to `_timeSetEvent@20'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x186): undefined reference to `_timeGetTime@0'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_systimer.o):SDL_systimer.c:(.text+ 0x1c5): undefined reference to `_timeBeginPeriod@4'
...
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_wingl.o):SDL_wingl.c:(.text+0xe21) : undefined reference to `_ChoosePixelFormat@8'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_wingl.o):SDL_wingl.c:(.text+0xf09) : undefined reference to `_DescribePixelFormat@16'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5yuv.o):SDL_dx5yuv.c:(.text+0x3a e): undefined reference to `_IID_IDirectDrawSurface3'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5events.o):SDL_dx5events.c:(.tex t+0x17d5): undefined reference to `_IID_IDirectInputDevice2A'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5events.o):SDL_dx5events.c:(.dat a+0x4): undefined reference to `_GUID_SysKeyboard'
c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1-dw2/../../..\libSDL.a(SDL_dx5events.o):SDL_dx5events.c:(.dat a+0x1c): undefined reference to `_GUID_SysMouse'
collect2: ld returned 1 exit status
Any help on this is much appreciated.
Thanks,
netwalker.