Linker Errors from SDL2 in my project

前端 未结 2 1125
一向
一向 2021-01-25 20:57

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         


        
相关标签:
2条回答
  • 2021-01-25 21:35

    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.

    0 讨论(0)
  • 2021-01-25 21:35

    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.

    0 讨论(0)
提交回复
热议问题