使用mysql c++连接器的未定义引用
Undefined reference using the mysql c++ connector
我正在尝试使用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::allocater>abi:cxx11 const"中:
/git_repos/FHM/Camer/Software/TextractMetadata/Build/Linux/../..//mysql-connector-c++-8.13/include/mysqlx/devapi/common.h:115:对`mysqlx::string::Impl::to_utf8[abi:cx_11](mysqlx:;string const&('的未定义引用
/tmp/cc6dzD4k.o:在函数"mysqlx::DbDoc::DbDoc(("中:
/git_repos/FHM/Camer/Software/TextractMetadata/Build/Linux/../..//mysql-connector-c++-8.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的vtable::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[_ZTIN6m ysqlx5valueE]+0x28(:对"mysqlx::common::Value的类型信息"的未定义引用
collect2:错误:ld返回1退出状态
生成文件: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
有人知道我在这里错过了什么吗?
您没有链接到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
- 对C宏的未定义引用,但在定义它时会出现重新定义错误
- 编译时的 CImg 库返回对"__imp_SetDIBitsToDevice"的未定义引用
- 对Py_Initialize()的未定义引用
- 使用mysql c++连接器的未定义引用
- 对 Scalar ::Scalar() 的未定义引用
- 对复制 CTOR 和 CTOR 的未定义引用
- 对显式实例化的模板函数的未定义引用
- TensorRT (C++ API) 对"createNvOnnxParser_INTERNAL"的未定义引用
- 2个模板化类的非模板友元函数未定义引用错误
- 编译 libfluid 样本控制器时对"event_base_del_virtual"的未定义引用
- 获取对function_name的未定义引用
- 对 'std::thread::_M_start_thread CMake 的未定义引用进行基准测试
- 对结构方法的未定义引用
- 使用内联函数 c++ 的未定义引用
- 对 CMake 中'cudaRegisterLinkedBinary'链接错误的未定义引用?
- 对 DLOPEN 的未定义引用
- QT C++中对全局变量的未定义引用
- 快速数学导致对"__pow_finite"的未定义引用
- 对 boost::system::d etail::system_category_instance 的未定义引用,从
- OpenCV 3.4.3 中对 'cv::String::d eallocate()' 错误的未定义引用