I'm working on a simple Hello World type program using C and SDL2 on a Windows platform (gcc compiler on Cygwin, running on Windows 7).
My program compiles fine and runs fine as long as I'm compiling with the dynamically linked libraries, and that the SDL2.dll file is in the same directory as my running program.
However, when I add the '-static' compiler flag to gcc line when compiling, I get a ton of "undefined reference" errors such as this:
undefined reference to `_imp__waveInAddBuffer@12'
Can anyone point me in the right direction of what the problem is here?
EDIT: I forgot to specify that I'm using MinGW as my compiler toolchain.
EDIT: I'm including the gcc compiler flag that worked (taken from the accepted answer below, plus a few additions from myself):
-Wl,-Bstatic -lmingw32 -lSDL2main -lSDL2 -Wl,-Bdynamic -lws2_32 -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinm m -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -lcomdlg32 -lhid -lsetupapi