2016-10-14 6 views
0

sqlpp-connector-mysqlを使用してデータベース接続を確立しようとしています。私はそれがなぜ `sqlpp-mysql`は正しくリンクされていませんか?

$ g++ -std=c++1y -lsqlpp-mysql SampleTest.cpp 

SampleTest.cpp:(.text+0x12f): undefined reference to `sqlpp::mysql::connection::connection(std::shared_ptr<sqlpp::mysql::connection_config> const&)' 
SampleTest.cpp:(.text+0x13e): undefined reference to `sqlpp::mysql::connection::~connection()' 
SampleTest.cpp:(.text+0x157): undefined reference to `sqlpp::mysql::connection::connection(std::shared_ptr<sqlpp::mysql::connection_config> const&)' 
SampleTest.cpp:(.text+0x19d): undefined reference to `sqlpp::mysql::connection::execute(std::string const&)' 
SampleTest.cpp:(.text+0x201): undefined reference to `sqlpp::mysql::connection::execute(std::string const&)' 
SampleTest.cpp:(.text+0x265): undefined reference to `sqlpp::mysql::connection::execute(std::string const&)' 
SampleTest.cpp:(.text+0x2c9): undefined reference to `sqlpp::mysql::connection::execute(std::string const&)' 

私は思うというエラーを生成SampleTest.cppを実行しようとしていたときに、このプロジェクトをビルドした後、sqlpp-mysqlが適切にリンクされていません。誰かが私にいくつかのポインタを与えることができる、どのようにこの問題を解決するには?

P.S:要件を構築しました。

  • date library
  • sqlpp11
    • は私が適切にライブラリをリンクするために必要なこの

      $ cd project_dir 
      $ cmake CmakeList.txt 
      $ sudo make install 
      

    答えて

    0

    ようsqlpp11sqlpp11-connector-mysql両方構築します。

    g++ -std=c++11 tests/SampleTest.cpp -I ../../sqlpp11/include -I . -I ../../date -lsqlpp-mysql -lmysqlclient 
    
    関連する問題