Ask Your Question
0

Please HeLp: error: missing argument to ‘-l’

asked 2014-02-03 06:06:56 -0600

Why I have these errors when I try to compile this :

g++ opencv.cpp -o opencv pkg-config --libs --cflags opencv

errors :

g++: error: missing argument to ‘-l’

edit retag flag offensive close merge delete

Comments

1

seems, your cmdline is missing the backticks around the pkg-config parts. see haris' answer below

berak gravatar imageberak ( 2014-02-03 06:43:08 -0600 )edit
1

the backticks are the problem ;) had the same problem yesterday and took me a while to find the reason...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-05 04:42:43 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2014-02-03 06:15:20 -0600

Haris gravatar image

updated 2014-02-03 06:17:59 -0600

Just try this command

g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib/ -g -o binaryName  main.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy

assumes you have installed in /usr/local directory.

or

g++ `pkg-config --cflags --libs opencv` opencv.cpp -o opencv
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-02-03 06:06:56 -0600

Seen: 2,045 times

Last updated: Feb 03 '14