私のCMake問題の解決策を見つけることができないようです。CMakeとC++でmysql-connectorを実行していますか?
私はmysqlのコネクタ-C++を使用したいとCURLは、私の/Desktop/example
ディレクトリに私は、次のCMakeLists.txtを作りました:
cmake_minimum_required (VERSION 3.1.0)
PROJECT (main)
ADD_EXECUTABLE (main main.cpp)
target_link_libraries(main curl mysql-connector-c++)
target_compile_features(main PRIVATE cxx_range_for)
私は私のmain.cppにで次のヘッダーを含めました:
#include <curl/curl.h>
#include <mysql_connection.h>
#include <driver.h>
#include <exception.h>
#include <resultset.h>
#include <statement.h>
私は、MySQLコネクタ-C++、解凍したためzip fileをダウンロードして、私の現在のディレクトリにこれを置いてきました。
私はその後cmake .
とmake
を実行したと、次のエラーが生成されます。私は、MySQLコネクタヘッダを削除すると、CURLが正常に動作として
fatal error:
'mysql_connection.h' file not found
これは奇妙です。
これはなぜ機能していないのですか?
N.B 次のコマンドは述べた結果と実行します。
g++ -std=c++14 -lcurl main.cpp //Success
g++ -std=c++14 -lcurl -lmysqlcppconn main.cpp //Fatal eror: 'mysql_connection.h' file not found
解凍したアーカイブを 'Desktop/example'の中に入れましたか? – fedepad
@fedepadこれは解凍された 'mysql-connector-C++'の代わりにするべきですか? –
必要ない、私はあなたが試みることができる答えを書いています... – fedepad