Ask Your Question
0

CMakeLists pkg-config opencv C++

asked 2016-12-25 22:15:48 -0500

sora gravatar image

updated 2016-12-25 22:18:16 -0500

I made program with "opencv2/nonfree/features2d.hpp" like this include.

#include "opencv2/nonfree/features2d.hpp"

When I compile the program, I need some option like this.

g++ filename.cpp `pkg-config opencv --cflags --libs`

These are no error. But I don't know how to write this on CMakeLists.

When I do catkin_make, these are same error that I compiled without option.

Please tell me.

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-27 01:10:38 -0500

ahendrix gravatar image

A quick google search for "cmake opencv" turns up: http://docs.opencv.org/2.4/doc/tutori...

Following the example there, it looks like you need to add the following to your CMakeLists:

find_package( OpenCV REQUIRED )

And then link to OpenCV with:

target_link_libraries( your_executable ${OpenCV_LIBS} )
edit flag offensive delete link more

Comments

I thought these are no link of nonfree in OpenCV.

But, I can solve it by your advice.

thanks

sora gravatar image sora  ( 2016-12-27 01:33:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-12-25 22:15:48 -0500

Seen: 862 times

Last updated: Dec 27 '16