Ask Your Question

Error on building OpenCV-2.4.3 on ubuntu 12.04

asked 2013-01-21 09:25:57 -0600

gk gravatar image

I am trying to install OpenCV-2.4.3 on ubuntu 12.04. In build directory on giving the command:- cmake -D CMAKE_BUILD_TYPE=RELEASE .. After that on giving the command :- make it gives error as :- make[2]: * [bin/opencv_perf_imgproc] Error 1 make[1]: [modules/imgproc/CMakeFiles/opencv_perf_imgproc.dir/all] Error 2 make: ** [all] Error 2

I made a few changes in the cmake command but it did not work. Please tell me how to correct this error.


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-01-21 12:07:59 -0600

VedMathai gravatar image

I too have tried to build using what you have done, it didn't seem like it went anywhere, and I don't remember if by running cmake, as you did above, any good came of it. What I do now, though, is run cmake in individual folders on individual .cpp files as and when I need them. It is seems to be working well. But I have just started and don't know if the problem may amplify later. Any how I will describe what I do below.

Go the folder where the .cpp file is stored. Right click and open a new Document. Call it 'CMakeLists.txt'. It is very important that you call it precisely that. Open the document and paste this.

project( name_of_cpp )

find_package( OpenCV REQUIRED )

add_executable( name_of_cpp name_of_cpp )

target_link_libraries( name_of_cpp ${OpenCV_LIBS} )

Where you replace 'name_of_cpp ' with the name of your cpp file.

Next you open terminal and go the folder using cd. Once you are there type in 'cmake ." Note:there is a space between cmake and the '.' . After that type in 'make'. You should see an executable being formed. Some executables require you to parse it an image file from command line. If u have the image in the same folder then you can run the executable using

./name_of_file name_of_image.jpg

or else, you can pass the image using its relative position to the active folder by using /../../image.jpg I think it should lie somewhere in the parent folder for this to work. (correct me if wrong). and last way is to give the absolute address in relation to home.

edit flag offensive delete link more

Question Tools


Asked: 2013-01-21 09:25:57 -0600

Seen: 925 times

Last updated: Jan 21 '13