安裝opencv3.3.0碰到的問題及解決方法

出處:http://osask.cn/front/ask/view/258965c++

CMakeError.logui

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-5
相關文章
相關標籤/搜索