External library inclusion - Eclipse CDT and MinGW -


i'm trying re-learn c++ , i'm working eclipse cdt on windows mingw , i'd include external library without modifying mingw installation. currently, i'm working sdl2, more generalized question.

i've compiled , run test program using following steps:

  1. download sdl2-devel-2.0.4.mingw.tar.gz (here) , extract it
  2. copy files sdl2-2.0.4\ mingw install:
    • \include\sdl2 %mingw%\include\
    • \lib\libsdl2.a %mingw%\lib\
    • \lib\libsdl2.dll.a %mingw%\lib\
    • \lib\libsdl2.la %mingw%\lib\
    • \lib\libsdl2main.a %mingw%\lib\
    • \bin\sdl2.dll %mingw%\bin\
  3. add libraries (in order) linker via project->properties : c/c++ build->settings : ("tool settings" tab) mingw c++ linker->libraries : "libraries (-l)" section
    • sdl2main
    • sdl2
  4. #include <sdl2\sdl.h> in cpp/h file
  5. build program
  6. copy sdl2.dll output directory .exe
  7. run

on particular machine, i'm using i686-w64-mingw32 build of sdl2-2.0.4, i'd point linker directly without copying mingw installation in step 2 above. include these files in repo without expecting correctly modified mingw install, or changing pointer x86_64-w64-mingw32 build on different machine, etc.

on different note (and separate question), there method of automating step 6? can't seem find it, , manually copying dlls on every clean build rather annoying...

you there, add include directories externally unzipped location of sdl2 , add library search path linking stage.

  1. project->properties : c/c++ build->settings : ("tool settings" tab) mingw c++ compiler->includes : "include paths (-i)" section

  2. project->properties : c/c++ build->settings : ("tool settings" tab) mingw c++ linker->libraries : "library search path (-l)" section

as other question, ensure have sdl2.dll on path , won't have copy it. if want copied, add post build steps: project->properties : c/c++ build->settings : ("build steps" tab) post-build steps : command


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -