2013年11月24日 星期日

compiling opencv with g++

There are two methods in compiling opencv with g++ without IDE

First is typing following command in command line directly

~$  g++ testcv.cpp -o testcv `pkg-config opencv --cflags --libs `

ps: ` place in the left of 1 on the keyboard, not ' in the left of Enter

 Second is to set a makefile as below:

testcv: testcv.cpp
g++  -o ${@} $<  `pkg-config opencv --cflags --libs `

and then type make in command line

~$ make

note:

keep the sequence of the command. put the `pkg-config opencv --cflags --libs ` after others.

If you make a command like

~$  g++  `pkg-config opencv --cflags --libs ` testcv.cpp -o testcv

there will be error

I don't know why...><
###########################################################################
opencv on qt creater ubuntu

set .pro

INCLUDEPATH += /usr/local/include

LIBS += `pkg-config opencv --libs`

If an error occur like this

"Cannot connect creator comm socket /tmp/qt_temp.S27961/stub-socket: No such file or directory"

go to "Run Settings" and then cancel "Run in terminal"
 

沒有留言:

張貼留言