c++ - mysql_version.h not found when building application with mysql++ -


i want connect mysql database c++ mysql++ library (wrapper) in linux (ubuntu 12.04). installed mysql via xampp linux, tried sudo apt-get istall mysql-server. got mysql++ lib sudo apt-get install libmysqlclient15-dev.

the include statement include <mysql++/mysql++.h> gave no warning, when i'm trying build application, compilation error:

in file included /usr/include/mysql++/connection.h:38:0, /usr/include/mysql++/mysql++.h:56, /home/bert/documents/qtprojecten/fgbg/modules/server/mysqldb.h:6, /home/bert/documents/qtprojecten/fgbg/modules/server/mysqldb.cpp:1: /usr/include/mysql++/common.h:131:28: fatal error: mysql_version.h: no such file or directory compilation terminated.

indeed there no mysql_version.h in /usr/include/mysql++ directory. have clue means? couldn't find documentation on matter , tried copy mysql_version.h-file /usr/include/mysql /usr/include/mysql++.

edit:

  • i have 2 mysql++ dirs in file system: /usr/local/include/mysql++ , /usr/include/mysql++. problem?
  • i changed #include <mysql++/mysql++.h> </usr/include/mysql++/mysql++.h>, didn't work.
  • when change gxx flags (-dmysqlpp_mysql_headers_buried or -i/usr/include/mysql) in cmakelist, doesn't recognize mysqlpp namespace anymore.

here code of header file:

#ifndef mysqldb_h #define mysqldb_h  #include <mysql++/mysql++.h>  class mysqldb{  public: mysqldb(); ~mysqldb(); bool open(std::string dbname, std::string hostname, std::string username, std::string password); mysqlpp::storequeryresult query(std::string sql); bool close();  private: mysqlpp::connection conn; }; #endif 

check if can link mysqlpp namespace using,

dpkg -l libmysql++-dev 

if yes, i.e. if have libmysqlpp.a, link using -lmysqlpp following,

 g++ sm_cpp.cpp -o test -i/usr/include/mysql++ -i/usr/include/mysql -lmysqlpp 

it work. linker searches standard list of directories library, file named liblibrary.a. linker uses file if had been specified precisely name. include <mysql++.h> - no such file or directory


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -