Home Building Opencv using cmake giving errors involving c++11
Reply: 2

Building Opencv using cmake giving errors involving c++11

Siladittya
1#
Siladittya Published in 2017-12-07 22:23:02Z

I am facing problem with the cmake command while compiling opencv on Ubuntu 16.04. When I execute the cmake command, I get the error

CMake Error at CMakeLists.txt:11 (message): FATAL: In-source builds are not allowed. You should create a separate directory for build files.

I have extracted the opencv source file in a folder named opencv-3.3.1 Then I have followed all the processes mentioned in this site

https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

I use the following commands :: cd opencv-3.3.1/ mkdir build/ cd build/ cmake -D CMA KE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.1/modules -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python -D BUILD_EXAMPLES=ON ..

But I am getting this error!

What can be the possible problem?

The CMakeError.log shows

error "C++11 is not supported

I have tried adding set(CMAKE_CXX_FLAGS "-std=c++11") to the beginning of the CMakeLists.txt and also included the flag -DENABLE_CXX11=ON to the CMAKE command flags. But nothing seems to work.

Please help!!

BHawk
2#
BHawk Reply to 2017-12-07 22:59:28Z

Try adding:

add_definitions(-std=c++11)

to your cmakelists file.

Wei Guo
3#
Wei Guo Reply to 2017-12-08 06:39:18Z

Maybe there is a file called CMakeCache.txt in your OpenCV root directory opencv-3.3.1.

Just remove it!

That's because someone have executed cmake . inside the root directory opencv-3.3.1 before.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303183 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO