问题描述
我正在尝试使用mySQL c ++连接器.我已经按照mysql指南 https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-binary.html
I'm trying to use the mySQL c++ connector.I have downloaded and extracted the binaries following the mysql guide https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-binary.html
当我像这样包含xdevapi时
When i include the xdevapi like so
#include <mysqlx/xdevapi.h>
我遇到以下错误
/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&)'
/git_repos/FHM/Camera/Software/ExtractMetadata/Build/Linux/../../../mysql-connector-c++-8.0.13/include/mysqlx/devapi/common.h:115: undefined reference to `mysqlx::string::Impl::to_utf8[abi:cxx11](mysqlx::string const&)'
/tmp/cc6dzD4k.o:在函数mysqlx :: DbDoc :: DbDoc()'中:
/tmp/cc6dzD4k.o: In function `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"
/git_repos/FHM/Camera/Software/ExtractMetadata/Build/Linux/../../../mysql-connector-c++-8.0.13/include/mysqlx/devapi/document.h:153: undefined reference to `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
vtable for mysqlx :: DbDoc'
/tmp/cc6dzD4k.o: In function 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 for 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: In function 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._ZTCN6mysqlx5ValueE0_NS_6common5ValueE[_ZTVN6mysqlx5ValueE]+0x18): undefined reference to 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):未定义引用`typeinfo for mysqlx :: common :: Value'
/tmp/cc6dzD4k.o:(.rodata._ZTIN6mysqlx5ValueE[_ZTIN6mysqlx5ValueE]+0x28): undefined reference to `typeinfo for mysqlx::common::Value'
collect2:错误:ld返回1个退出状态
collect2: error: ld returned 1 exit status
Makefile:2:目标"x86"的配方失败
Makefile:2: recipe for target 'x86' failed
make:*** [x86]错误1
make: *** [x86] Error 1
我的Makefile如下:
My Makefile look like this:
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 \
有人知道我在这里想念什么吗?
Does anyone know what I'm missing here?
推荐答案
您未与MySQL库链接:
You are not linking with the MySQL library:
-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
这篇关于使用mysql c ++连接器的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!