Linking problem on cygwin

When compiling with:
g++ -c -o client.o -D__cygwin__ -O sdl-config --cflags client.cpp

And linking with:
g++ -D__cygwin__ -o client.exe client.o sdl-config --libs

I get the error:
/usr/local/lib/libSDLmain.a(SDL_win32_main.o): In function console_main': /home/Miffe/SDL-1.2.8/src/main/win32/SDL_win32_main.c:249: undefined reference to_SDL_main’
collect2: ld returned 1 exit status

SDL was ./configure’d with --disable-stdio-redirect.

$ sdl-config --cflags
-I/usr/local/include/SDL -Dmain=SDL_main -I/usr/include/mingw -DWIN32
-Uunix -mno-cygwin

$ sdl-config --libs
-L/usr/local/lib -lmingw32 -lSDLmain -lSDL -mwindows -mno-cygwin

Anyone know how to fix this?

– Mikael Eriksson

Make sure your ‘main’ function is really

int main(int argc, char *argv[]) {

}

and not ‘void main’ etc.

Andreas Umbach wrote:

Make sure your ‘main’ function is really

int main(int argc, char *argv[]) {

}

and not ‘void main’ etc.

int main() actually.
I feel a little stupid now.