c++ - Undefined reference to get_mysql_instance -


i'm writing code in c++ mysql cpp conn 6.1 connect database , write data later use. when trying initialize driver driver = get_driver_instance(); returns error message:

creating executable: out/gcc-debug//db8.exe out/gcc-debug//defaultsensor.o: in function `z10dbwritewiniiiii': c:\users\luish.forchesatto\dropbox\projetosomnet++\db8/dbwritewin.h:35: undefined reference `_imp___zn3sql5mysql19get_driver_instanceev' collect2.exe: error: ld returned 1 exit status makefile:85: recipe target 'out/gcc-debug//db8.exe' failed make: *** [out/gcc-debug//db8.exe] error 1 

i tried add mysqlcppconn link option (-lmysqlcppconn) returns following error message:

creating executable: out/gcc-debug//db8.exe c:\users\luish.forchesatto\downloads\omnetpp-4.6\tools\win32\mingw32\bin/ld.exe: cannot find -lmysqlcppconn collect2.exe: error: ld returned 1 exit status makefile:85: recipe target 'out/gcc-debug//db8.exe' failed make: *** [out/gcc-debug//db8.exe] error 1 
  • this error applies if include full path mysqlcppconn.dll or .lib including directories paths , symbols.

the non initialized driver variable may causing crashes when trying connect database needs work.

the paths , symbols contains includes mysqlcppconn headers , boost library headers. full code application in link below.

https://dl.dropboxusercontent.com/u/85576999/dbwritewin.h

2 possible error causes, - refering undeclered function or variable ii - aren´t including proper library in compilation time


Comments