安装opencv3.3.0碰到的问题及解决方法
出处:http://osask.cn/front/ask/view/258965
CMakeError.log
Compilation failed:
source file: '/home/jhros/opencv-3.3.0/cmake/checks/cxx11.cpp'
check option: ''
===== BUILD LOG =====
Change Dir: /home/jhros/opencv-3.3.0/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_f915e/fast"
/usr/bin/make -f CMakeFiles/cmTC_f915e.dir/build.make CMakeFiles/cmTC_f915e.dir/build
make[1]: Entering directory '/home/jhros/opencv-3.3.0/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_f915e.dir/cxx11.cpp.o
/usr/bin/c++ -o CMakeFiles/cmTC_f915e.dir/cxx11.cpp.o -c /home/jhros/opencv-3.3.0/cmake/checks/cxx11.cpp
/home/jhros/opencv-3.3.0/cmake/checks/cxx11.cpp:4:2: error: #error "C++11 is not supported"
#error "C++11 is not supported"
^
/home/jhros/opencv-3.3.0/cmake/checks/cxx11.cpp: In function ‘int main()’:
/home/jhros/opencv-3.3.0/cmake/checks/cxx11.cpp:11:10: error: ‘res’ does not name a type
auto res = test();
^
/home/jhros/opencv-3.3.0/cmake/checks/cxx11.cpp:12:12: error: ‘res’ was not declared in this scope
return res;
^
CMakeFiles/cmTC_f915e.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_f915e.dir/cxx11.cpp.o' failed
make[1]: *** [CMakeFiles/cmTC_f915e.dir/cxx11.cpp.o] Error 1
make[1]: Leaving directory '/home/jhros/opencv-3.3.0/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_f915e/fast' failed
make: *** [cmTC_f915e/fast] Error 2
如果碰到以上问题,请检查编译器,如果不是gcc7(不知道6可不可以)请升级到7 即可
Build output check failed: Regex: 'command line option .* is valid for .* but not for C\+\+' Output line: 'cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++' Compilation failed: source file: '/home/jhros/opencv-3.3.0/build/CMakeFiles/CMakeTmp/src.cxx' check option: ' -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes
如果有如下问题,请在编译选项添加
CMAKE_C_COMPILER=/usr/bin/gcc-7
即可解决问题