我試圖在Xcode中使用MySQL連接器/ C++。我已經安裝了MySQL服務器。我還使用brew安裝了MySQL Connector/C++和Boost。我相信所有文件都是他們應該在的地方。在Xcode中使用MySQL連接器/ C++:-libmysqlcppconn庫未找到
我已經包括庫搜索路徑:
1)/usr/local/mysql-5.6.24-osx10.8-x86_64/lib
2)的/ usr /本地/ MySQL的/ lib中
我只是想簡單的代碼,我潛水之前運行更深一點:
#include <stdlib.h>
#include <iostream>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
using namespace std;
int main(int argc, const char * argv[]) {
sql::mysql::MySQL_Driver *driver;
sql::Connection *con;
driver = sql::mysql::get_mysql_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "user", "password");
delete con;
return 0;
}
我得到的錯誤是:ld: library not found for -libmysqlcppconn
任何幫助將不勝感激!
我也嘗試在目標的構建階段手動添加庫,但那也沒有工作。還有其他建議嗎? – jbd36