使用mysql c++连接器的未定义引用

pinkon5k  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(622)

我正在尝试使用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::u cxx11::basic_string,std::allocator>abi:cxx11 const': /git\u repos/fhm/camera/software/extractmatadata/build/linux/../../../mysql-connector-c++-8.0.13/include/mysqlx/devapi/common.h:115:未定义对mysqlx::string::impl::to\u utf8的引用[abi:cxx11](mysqlx::string const&)'
/tmp/cc6dzd4k.o:在函数“mysqlx::dbdoc::dbdoc()”中:
/git\u repos/fhm/camera/software/extractmatadata/build/linux/../../../mysql-connector-c++-8.0.13/include/mysqlx/devapi/document.h:153:未定义对“vtable for mysqlx::dbdoc”的引用
/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 mysqlx::dbdoc的vtable
/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.\u ztcn6mysqlx5value0\u ns\u 6common5valuee[\u 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.\u ztin6mysqlx5valuee[\u ztin6mysqlx5valuee]+0x28):未定义对“mysqlx的typeinfo::common::value”的引用
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 \

有人知道我错过了什么吗?

nwo49xxi

nwo49xxi1#

您没有链接到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

相关问题