链接期间无法找到 OpenCV(从源代码编译)

链接期间无法找到 OpenCV(从源代码编译)

我正在尝试编译qgifer-0.2.1-source来自 Ubuntu 中的源代码。我已安装所有依赖项。我按照源代码 README 中的以下说明进行编译。

cd qgifer_source_dir
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX="/usr/local/" -DQUIET_MODE=ON
make
sudo make install

一切都进行得很顺利,包括编译和 obj 创建,但是当它开始链接时,文件frameplayer.cpp失败了。

这似乎是 OpenCV 包的问题。我已按照以下说明安装了 OpenCV操作说明

OpenCV详细信息:

$ pkg-config opencv --libs
-L/usr/local/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core -lopencv_hal 

错误文件frameplayer.cpp的头部包含:

#ifndef FRAMEPLAYER_H
#define FRAMEPLAYER_H

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

OpenCV 在我的系统中安装如下:

  1. 这包含 OpenCV 的 cmake 配置文件

    /usr/local/share/OpenCV
    
  2. hpp 文件 (core, highgui ..) 位于

    /usr/local/include/opencv2
    

这些我试过,但没有用

  • 重新安装 OpenCV

  • hpp通过使用完整文件路径更改头文件来再次配置源,并make

任何帮助,将不胜感激。

错误详情:

arindam@arindam-sandbox:~/Downloads/qgifer-0.2.1-source/build$ sudo make
[  1%] Generating qrc_res.cxx
[  3%] Generating src/moc_frameplayer.cxx
[  4%] Generating src/moc_previewwidget.cxx
[  6%] Generating src/moc_mainwindow.cxx
..............
..............
[ 96%] Building CXX object CMakeFiles/qgifer.dir/src/moc_interpolationdialog.cxx.o
[ 98%] Building CXX object CMakeFiles/qgifer.dir/src/moc_textobject.cxx.o
[100%] Building CXX object CMakeFiles/qgifer.dir/qrc_res.cxx.o
Linking CXX executable qgifer
CMakeFiles/qgifer.dir/src/frameplayer.cpp.o: In function `FramePlayer::FramePlayer(QWidget*)':
frameplayer.cpp:(.text+0x984): undefined reference to `cv::VideoCapture::VideoCapture()'
frameplayer.cpp:(.text+0xddf): undefined reference to `cv::VideoCapture::~VideoCapture()'
CMakeFiles/qgifer.dir/src/frameplayer.cpp.o: In function `FramePlayer::~FramePlayer()':
frameplayer.cpp:(.text+0xf07): undefined reference to `cv::VideoCapture::~VideoCapture()'
CMakeFiles/qgifer.dir/src/frameplayer.cpp.o: In function `FramePlayer::~FramePlayer()':
frameplayer.cpp:(.text+0xf77): undefined reference to `cv::VideoCapture::~VideoCapture()'
CMakeFiles/qgifer.dir/src/frameplayer.cpp.o: In function `FramePlayer::nextFrame()':
..............
mainwindow.cpp:(.text+0x6f8c): undefined reference to `cv::VideoCapture::isOpened() const'
mainwindow.cpp:(.text+0x7139): undefined reference to `cv::VideoCapture::get(int) const'
collect2: error: ld returned exit 1 status
CMakeFiles/qgifer.dir/build.make:1123: recipe for target 'qgifer' failed
make    [2]: ***     [qgifer] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/qgifer.dir/all' failed
make    [1]: ***     [CMakeFiles/qgifer.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: ***     [all] Error 2

相关内容