Cmake opencv-对KalmanFilter的未定义引用
我有一个opencv项目,到目前为止,所有项目都运行良好,直到今天我刚刚尝试重新构建代码:我遇到了以下错误:Cmake opencv-对KalmanFilter的未定义引用,cmake,opencv3.0,kalman-filter,Cmake,Opencv3.0,Kalman Filter,我有一个opencv项目,到目前为止,所有项目都运行良好,直到今天我刚刚尝试重新构建代码:我遇到了以下错误: undefined reference to `cv::KalmanFilter::KalmanFilter(int, int, int, int)' undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' undefined reference to `cv::wa
undefined reference to `cv::KalmanFilter::KalmanFilter(int, int, int, int)'
undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
undefined reference to `cv::waitKey(int)'
我不确定为什么会发生此错误,我只能假设它可能与我运行了sudo apt get autoremove
或sudo apt get upgrade
这一事实有关。我之前做的另一件事是安装arduino
我不知道为什么会出现这个错误,因为直到今天我一直都能编译
卡尔曼滤波器的opencv包含是否已更改?这是我的一个剪贴画,包括:
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/video/video.hpp> //for kalman filter
//Include headers for OpenCV GUI handling
#include <opencv2/highgui/highgui.hpp>
我已运行opencv 3.3.1。刚刚找到解决方案: 我必须链接到opencv的libs 在我的CMakeLists.txt中,我添加了:
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBS})
target_link_libraries(example_node ${PROJECT_NAME})
我不知道为什么我的代码以前可以工作,但现在停止了工作。无论如何,现在它会再次编译:)可能与
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBS})
target_link_libraries(example_node ${PROJECT_NAME})