I used CMake and Code::Blocks to build SDL2 from source, and attempted to link my own project source to the following static libraries:
libSDL2.a
libSDL2main.a
O
If you link with static SDL, you need to manually pull all libraries it uses:
imagehlp dinput8 dxguid dxerr8 user32 gdi32 winmm imm32 ole32
oleaut32 shell32 version uuid
Or just use dynamic SDL2.
SDL2main
goes before SDL2
. Linking order matters.
Also, I'm sorry, but I must say that this
I obtained libSDL2 and libSDL2main from the Code::Blocks build. I obtained OpenGL32 from my Windows directory
sounds weird. You shouldn't do it like this.
I'm not sure what you mean by "Code::Blocks build", but you should obtain SDL libs as well as includes for it from http://libsdl.org/download-2.0.php and nowhere else. It's called "MinGW build".
OpenGL, on the other hand, shouldn't be obtained anywhere. It should already be a part of your compiler package. You can link it with just -lOpenGL32
.