如何解决:-1:错误:没有规则来制作目标`/home/xxxxx/opencv-3.0.0/lib/libopencv_xphoto.so.3.0.0&#39 ;,需要`xxxxx'。停止

时间:2015-09-12 23:21:54

标签: cmake target opencv3.0

我正在尝试使用cmake来编译OpenCV 3.0中的代码。我试着让它变得尽可能简单:

project(xxxxx)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
find_package(OpenCV)
message("Libs: ${OpenCV_LIBS}")
message("Include Dir: ${OpenCV_INCLUDE_DIRS}")
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
)

我在main.cpp中的所有内容都是:

#include <opencv2/core.hpp>

cv::UMat trqw;

我得到了#34;没有规则来制定目标&#34;错误。该错误表明它正在查看&#34; opencv-3.0.0 / lib /&#34;文件夹不存在,它应该在&#34; opencv-3.0.0 / build / lib /&#34;中查找。当我构建OpenCV使CMAKE包看起来错误时,我做错了什么,如果没有,我的CMakeLists.txt是否有更好的方法来指导它查找正确的文件夹?我试过&#34; $ {OPENCL_LIBRARIES}&#34;在target_link_libraries调用中没有变化。

谢谢!

----编辑----------------

是的,我的cmakelists.txt中确实有find_package(OpenCV),谢谢!我也试过find_package(OpenCV 3.0)和find_package(OpenCV 3.0 REQUIRED)但没有用。

----------编辑--------------- 输出

message("Libs: ${OpenCV_LIBS}") # I added it to the orig question

利布斯:opencv_xphoto; opencv_xobjdetect; opencv_ximgproc; opencv_xfeatures2d; opencv_tracking; opencv_text; opencv_surface_matching; opencv_stereo; opencv_saliency; opencv_rgbd; opencv_reg; opencv_optflow; opencv_line_descriptor; opencv_face; opencv_dpm; opencv_datasets; opencv_ccalib; opencv_bioinspired; opencv_bgsegm; opencv_aruco; opencv_adas; opencv_world; opencv_videostab ; opencv_videoio; opencv_video; opencv_superres; opencv_stitching; opencv_shape; opencv_photo; opencv_objdetect; opencv_ml; opencv_imgproc; opencv_imgcodecs; opencv_highgui; opencv_hal; opencv_flann; opencv_features2d; opencv_core; opencv_calib3d

包括目录:

/home/xxxxx/opencv-3.0.0/build;/home/xxxxx/opencv-3.0.0/include;/home/xxxxx/opencv-3.0.0/include/opencv;/home/xxxxx/opencv -3.0.0 /模块/ HAL /包括; /home/xxxxx/opencv-3.0.0/modules/core/include; /home/xxxxx/opencv-3.0.0/modules/flann/include; /家庭/ XXXXX /的OpenCV-3.0.0 /模块/ imgproc /包括; /home/xxxxx/opencv-3.0.0/modules/ml/include; /home/xxxxx/opencv-3.0.0/modules/photo/include; /家/ XXXXX /opencv-3.0.0/opencv_contrib-master/modules/reg/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/surface_matching/include;/home/xxxxx/opencv-3.0.0/modules /video/include;/home/xxxxx/opencv-3.0.0/modules/imgcodecs/include;/home/xxxxx/opencv-3.0.0/modules/shape/include;/home/xxxxx/opencv-3.0.0/模块/ videoio /包括; /home/xxxxx/opencv-3.0.0/modules/highgui/include; /home/xxxxx/opencv-3.0.0/modules/objdetect/include; /home/xxxxx/opencv-3.0.0 /opencv_contrib-master/modules/optflow/include;/home/xxxxx/opencv-3.0.0/modules/superres/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/module S /跟踪/包括:/home/xxxxx/opencv-3.0.0/modules/ts/include; /home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/xobjdetect/include; /家/ XXXXX / OpenCV的-3.0.0 / opencv_contrib主/模块/ xphoto /包括; /home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/adas/include; /home/xxxxx/opencv-3.0.0/opencv_contrib-master /modules/bgsegm/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/bioinspired/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/dpm/include;/家/ XXXXX / OpenCV的-3.0.0 / opencv_contrib主/模块/脸/包括; /home/xxxxx/opencv-3.0.0/modules/features2d/include; /home/xxxxx/opencv-3.0.0/opencv_contrib-主/模块/ line_descriptor /包括; /home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/saliency/include; /home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/text/include; /home/xxxxx/opencv-3.0.0/modules/calib3d/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/ccalib/include;/home/xxxxx/opencv-3.0.0/opencv_contrib -master /模块/数据集/包括:/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/rgbd/include; /home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/stereo/include; /家/ XXXXX /opencv-3.0.0/modules/stitching/include;/home/xxxxx/opencv-3.0.0/modules/videostab/include;/home/xxxxx/opencv-3.0.0/modules/world/include;/home/ XXXXX / OpenCV的-3.0.0 / opencv_contrib主/模块/ xfeatures2d /包括; /home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/ximgproc/include; /home/xxxxx/opencv-3.0.0/ opencv_contrib主/模块/ aruco /包括

1 个答案:

答案 0 :(得分:1)

感谢Tsyvarez提供的所有帮助!

def sortable(column, title = nil)
  title ||= column.titleize
  d = (column == sort_column && sort_direction == 'asc') ? 'desc' : 'asc'
  link_to (title + glyph("sort-#{sort_direction}") ).html_safe, sort: column, direction: d

set ( OpenCV_DIR   "/home/xxxxx/opencv-3.0.0/build/")

在cmakelists.txt

谢谢!