[ 56%] Building CXX object modules/text/CMakeFiles/opencv_text.dir/src/erfilter.cpp.o
In file included from /Users/zhangxin/github/opencv_contrib/modules/text/src/erfilter.cpp:43:
In file included from /Users/zhangxin/github/opencv_contrib/modules/text/src/precomp.hpp:54:
In file included from /usr/local/include/tesseract/baseapi.h:27:
In file included from /usr/local/include/tesseract/apitypes.h:23:
/usr/local/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr'
constexpr int kPointsPerInch = 72;
^
/usr/local/include/tesseract/publictypes.h:33:11: error: expected unqualified-id
constexpr int kPointsPerInch = 72;
^
/usr/local/include/tesseract/publictypes.h:38:1: error: unknown type name 'constexpr'
constexpr int kMinCredibleResolution = 70;
^
/usr/local/include/tesseract/publictypes.h:38:11: error: expected unqualified-id
constexpr int kMinCredibleResolution = 70;
^
/usr/local/include/tesseract/publictypes.h:40:1: error: unknown type name 'constexpr'
constexpr int kMaxCredibleResolution = 2400;
^
/usr/local/include/tesseract/publictypes.h:40:11: error: expected unqualified-id
constexpr int kMaxCredibleResolution = 2400;
^
/usr/local/include/tesseract/publictypes.h:45:1: error: unknown type name 'constexpr'
constexpr int kResolutionEstimationFactor = 10;
^
/usr/local/include/tesseract/publictypes.h:45:11: error: expected unqualified-id
constexpr int kResolutionEstimationFactor = 10;
^
8 errors generated.
make[2]: *** [modules/text/CMakeFiles/opencv_text.dir/src/erfilter.cpp.o] Error 1
make[1]: *** [modules/text/CMakeFiles/opencv_text.dir/all] Error 2
@alalek I define constexpr to const, Compiling is Ok. It's not a good idea.
sudo vim /usr/local/include/tesseract/publictypes.h
then add this line:
#define constexpr const
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=/Users/zhangxin/github/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON \
-D BUILD_opencv_legacy=OFF \
..
make
sudo make install
I encountered the same problem and I manage to solve the problem without adding "#define constexpr const". I add -DENABLE_PRECOMPILED_HEADERS=OFF to make it work. Here is my complete cmake.
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCUDA_GENERATION=Kepler -DINSTALL_PYTHON_EXAMPLES=ON -DINSTALL_C_EXAMPLES=OFF -DOPENCV_EXTRA_MODULES_PATH=/home/mark/opencv_tools/opencv_contrib/modules -DENABLE_CXX11=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_EXAMPLES=ON -DBUILD_opencv_legacy=OFF ..
@markpanizales
Thank you man. Work like a charm
Most helpful comment
@alalek I define constexpr to const, Compiling is Ok. It's not a good idea.
then add this line: