我正在 ROS2 中构建一个包。当undefined reference to
我想在头文件中包含动态库 qpOASES 时发生错误。
qpOASES 安装在~
. 我试过了find_package(qpOASES REQUIRED)
。但我得到了错误
By not providing "FindqpOASES.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "qpOASES", but CMake did not find one.
在我使用的头文件#include <qpOASES.hpp>
中。在我使用的 CMakeList.txt 文件target_link_libraries(my_node Eigen3::Eigen ~/qpOASES-3.2.1/bin/libqpOASES.so)
中。但是当我编译它时,出现了以下错误。
ltv_mpc_controller.cpp:(.text+0x4a07): undefined reference to `qpOASES::SQProblem::SQProblem(int, int, qpOASES::HessianType, qpOASES::BooleanType)'
ltv_mpc_controller.cpp:(.text+0x4a7b): undefined reference to `qpOASES::QProblem::init(double const*, double const*, double const*, double const*, double const*, double const*, double const*, int&, double*, double const*, double const*, qpOASES::Bounds const*, qpOASES::Constraints const*, double const*)'
ltv_mpc_controller.cpp:(.text+0x4aeb): undefined reference to `qpOASES::SQProblem::hotstart(double const*, double const*, double const*, double const*, double const*, double const*, double const*, int&, double*, qpOASES::Bounds const*, qpOASES::Constraints const*)'
有谁知道如何解决这个错误?