OpenCV生成文件不会生成可执行文件

时间:2020-05-28 14:55:22

标签: c++ opencv makefile cmake gnu-make

我是C ++的新手,我正在尝试使用Cmake https://docs.opencv.org/master/db/df5/tutorial_linux_gcc_cmake.html

重新创建openCV教程。

我下载了Windows的.exe,并通过

用cmake构建了源代码。
cmake.exe -G "MinGW Makefiles"

然后,我尝试在带有调试标志的项目文件夹中使用make命令。我收到以下输出:

GNU Make 4.2.1
Built for i686-pc-msys
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Updating makefiles....
 Considering target file 'Makefile'.
  Looking for an implicit rule for 'Makefile'.
  No implicit rule found for 'Makefile'.
  Finished prerequisites of target file 'Makefile'.
 No need to remake target 'Makefile'.
Updating goal targets....
Considering target file 'default_target'.
 File 'default_target' does not exist.
  Considering target file 'all'.
   File 'all' does not exist.
    Considering target file 'cmake_check_build_system'.
     File 'cmake_check_build_system' does not exist.
     Finished prerequisites of target file 'cmake_check_build_system'.
    Must remake target 'cmake_check_build_system'.
Putting child 0x2004f248 (cmake_check_build_system) PID 22640 on the chain.
Live child 0x2004f248 (cmake_check_build_system) PID 22640
Microsoft Windows [Version 10.0.18362.836]
(c) 2019 Microsoft Corporation. All rights reserved.

我不太了解输出,因此谷歌搜索并没有帮助。由于我最后没有可执行文件(如本教程中所述),因此似乎存在一些问题。我想念什么?

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
set(OpenCV_DIR "C:/Users/XXX/opencv/opencv")
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

CMake输出:

cmake.exe -G "MinGW Makefiles"
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is GNU 4.9.3
-- The CXX compiler identification is GNU 4.9.3
-- Check for working C compiler: C:/Rtools/mingw_64/bin/gcc.exe
-- Check for working C compiler: C:/Rtools/mingw_64/bin/gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Rtools/mingw_64/bin/g++.exe
-- Check for working CXX compiler: C:/Rtools/mingw_64/bin/g++.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: C:/Users/XXX/opencv/opencv (found version "4.3.0")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/XXX/Documents/C++

生成输出(minGW-32)

mingw32-make.exe VERBOSE=1
"C:\Program Files\CMake\bin\cmake.exe" -SC:\Users\XXX\Documents\C++ -BC:\Users\XXX\Documents\C++ --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_progress_start C:\Users\XXX\Documents\C++\CMakeFiles C:\Users\XXX\Documents\C++\CMakeFiles\progress.marks
mingw32-make.exe  -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'C:/Users/XXX/Documents/C++'
mingw32-make.exe  -f CMakeFiles\DisplayImage.dir\build.make CMakeFiles/DisplayImage.dir/depend
mingw32-make.exe[2]: Entering directory 'C:/Users/XXX/Documents/C++'
"C:\Program Files\CMake\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\Users\XXX\Documents\C++ C:\Users\XXX\Documents\C++ C:\Users\XXX\Documents\C++ C:\Users\XXX\Documents\C++ C:\Users\XXX\Documents\C++\CMakeFiles\DisplayImage.dir\DependInfo.cmake --color=
mingw32-make.exe[2]: Leaving directory 'C:/Users/XXX/Documents/C++'
mingw32-make.exe  -f CMakeFiles\DisplayImage.dir\build.make CMakeFiles/DisplayImage.dir/build
mingw32-make.exe[2]: Entering directory 'C:/Users/XXX/Documents/C++'
mingw32-make.exe[2]: *** No rule to make target 'C:/Users/XXX/opencv_mingw/sources/build_mingw/lib/libopencv_dnn430.dll.a', needed by 'DisplayImage.exe'.  Stop.
mingw32-make.exe[2]: Leaving directory 'C:/Users/XXX/Documents/C++'
CMakeFiles\Makefile2:94: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed
mingw32-make.exe[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/XXX/Documents/C++'
makefile:102: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2

0 个答案:

没有答案
相关问题