我正在尝试使用mySQL c ++连接器。 我已经按照mysql指南https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-binary.html
下载并提取了二进制文件当我像这样包含xdevapi时
#include <mysqlx/xdevapi.h>
我遇到以下错误
/tmp/cc6dzD4k.o:在函数mysqlx :: string :: operator std :: __ cxx11 :: basic_string,std :: allocator> abi:cxx11 const':
/ git_repos / FHM / Camera / Software / ExtractMetadata / Build / Linux /../../../ mysql-connector-c ++-8.0.13 / include / mysqlx / devapi / common.h:115:未定义引用`mysqlx :: string :: Impl :: to_utf8 [abi:cxx11](mysqlx :: string const&)'
/tmp/cc6dzD4k.o:在函数mysqlx :: DbDoc :: DbDoc()中:
/ git_repos / FHM / Camera / Software / ExtractMetadata / Build / Linux /../../../ mysql-connector-c ++-8.0.13 / include / mysqlx / devapi / document.h:153:未定义引用“针对mysqlx :: DbDoc的vtable”
/tmp/cc6dzD4k.o:在函数
mysqlx::DbDoc::~DbDoc()': /git_repos/FHM/Camera/Software/ExtractMetadata/Build/Linux/../../../mysql-connector-c++-8.0.13/include/mysqlx/devapi/document.h:127: undefined reference to
vtable中,适用于mysqlx :: DbDoc'/tmp/cc6dzD4k.o:在函数
中mysqlx::Value::print(std::ostream&) const': /git_repos/FHM/Camera/Software/ExtractMetadata/Build/Linux/../../../mysql-connector-c++-8.0.13/include/mysqlx/devapi/document.h:507: undefined reference to
mysqlx :: common :: Value :: print(std :: ostream&)const'/tmp/cc6dzD4k.o :(。rodata._ZTCN6mysqlx5ValueE0_NS_6common5ValueE [_ZTVN6mysqlx5ValueE] + 0x18):未定义引用
typeinfo for mysqlx::common::Value' /tmp/cc6dzD4k.o:(.rodata._ZTCN6mysqlx5ValueE0_NS_6common5ValueE[_ZTVN6mysqlx5ValueE]+0x20): undefined reference to
mysqlx :: common :: Value :: print(std :: ostream&)const'>/tmp/cc6dzD4k.o :(。rodata._ZTIN6mysqlx5ValueE [_ZTIN6mysqlx5ValueE] + 0x28):对mysqlx :: common :: Value的'typeinfo'的未定义引用
collect2:错误:ld返回1个退出状态
Makefile:2:目标“ x86”的配方失败
make:*** [x86]错误1
我的Makefile如下:
g++ -I../../Src -I../../../Fee/Src \
-I/../../../OpenCV/include/opencv \
-I../../../OpenCV/include/opencv2 \
-I../../../mysql-connector-c++-8.0.13/include/ \
-L../../../OpenCV/lib/LinX86 \
-L../../../mysql-connector-c++-8.0.13/lib64/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread \
-g -D LINUX -o extractmetadata ../../Src/extractMetadata.cpp ../../../Fee/Src/Status.cpp \
-std=c++11 \
-lopencv_world -lstdc++fs \
有人知道我在这里想念什么吗?
答案 0 :(得分:2)
您未链接到MySQL库:
-L../../../mysql-connector-c++-8.0.13/lib64/libmysqlcppconn8-static.a
使用:
../../../mysql-connector-c++-8.0.13/lib64/libmysqlcppconn8-static.a
或:
-L../../../mysql-connector-c++-8.0.13/lib64/ -lmysqlcppconn8-static