Skip to content

/usr/local/include/tesseract/publictypes.h:33:1: error: unknown type name 'constexpr' #1388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ZhangXinNan opened this issue Oct 1, 2017 · 5 comments

Comments

@ZhangXinNan
Copy link

System information (version)
  • OpenCV => 3.3
  • Operating System / Platform => Mac OSX
  • Compiler => CMake
Detailed description
[ 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

Steps to reproduce
@alalek
Copy link
Member

alalek commented Oct 1, 2017

#1378 (comment)

@ZhangXinNan
Copy link
Author

ZhangXinNan commented Oct 1, 2017

@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

@ZhangXinNan
Copy link
Author

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

@markpanizales
Copy link

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 ..

@gachiemchiep
Copy link

@markpanizales

Thank you man. Work like a charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants