c++ - How do I link a library? (MySQL Library) -
alright, trying link program , never linked before need not linking (because have directory in linker -> additional directories need link against libmysql.lib/dll. not sure how that.
if give me basic understanding great! don't make complex ;)
i trying follow steps on website , says this: (i have looked , people said makefile , don't know how works)
the connector/c++ static library file mysqlcppconn-static.lib. link library statically application. link against files libmysql.dll , libmysql.lib. @ runtime, application require access libmysql.dll.
here's need install library c++ project.
- add additional depencies in linker.
project->properties->linker->input
click dropdown, click edit. on list on top, add names every .lib file included in library. example, if installing sdl, 1 add:
sdl2.lib sdl2main.lib
these files can found under lib folder of library downloaded (look around bit).
tell vs header files are.
project->properties->vc++ directories->include directories
click dropdown, click edit. add location of of header files of library. can put them wherever want, suggested put them in own folder in project folder somewhere. wherever put them, put directory here; containing folder, not files themselves.
tell vs lib files are.
project->properties->vc++directories->library directories
click dropdown, edit. same thing step 2, instead putting location of .lib files. yep, same ones defined in step 1.
- provide .dll files executable.
when executable runs, needs .dll in same directory or not run (correction = run, give error upon open). find executable , put .dll files in same directory. how find default:
solution explorer->right click solution->open in explorer->debug
you should see .exe there. put libraries dll files in same directory.
if have questions please ask.
Comments
Post a Comment