3
votes

I want to compile opencv from source on ubuntu 16.04. I already did this successfully a couple of times before. I am following this tutorial from pyimagesearch. Normally this works very well, but this time I am getting the following error for the contrib module text.

[ 27%] Generating precomp.hpp.gch/opencv_text_RELEASE.gch In file

included from /usr/include/c++/5/cinttypes:35:0,

from /usr/local/include/tesseract/host.h:30, from /usr/local/include/tesseract/serialis.h:26, from /usr/local/include/tesseract/baseapi.h:37, from /home/rvq/github/opencv-3.2.0/build/modules/text/precomp.hpp:51:

/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support \ ^

[ 27%] Built target pch_Generate_opencv_saliency

Does somebody know how to resolve this?

1

1 Answers

5
votes

Adding -D ENABLE_PRECOMPILED_HEADERS=OFF \ to CMake command resolved the issue.

Complete CMake Command:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D INSTALL_C_EXAMPLES=OFF \
    -D OPENCV_EXTRA_MODULES_PATH=~/github/opencv_contrib-3.2.0/modules \
    -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
    -D ENABLE_PRECOMPILED_HEADERS=OFF \
    -D BUILD_EXAMPLES=ON ..