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:
- download
sdl2-devel-2.0.4.mingw.tar.gz(here) , extract it - copy files
sdl2-2.0.4\mingwinstall:- \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\
- add libraries (in order) linker via project->properties : c/c++ build->settings : ("tool settings" tab) mingw c++ linker->libraries : "libraries (-l)" section
- sdl2main
- sdl2
#include <sdl2\sdl.h>in cpp/h file- build program
- copy
sdl2.dlloutput directory .exe - 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.
project->properties : c/c++ build->settings : ("tool settings" tab) mingw c++ compiler->includes : "include paths (-i)" section
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
Post a Comment