Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to solve this issue?

you have to LINK the opencv libraries to your program, like:

g++ -std=c++11 -o out main.cpp -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui

for openv4, you also need to correct the INCLUDE path:

g++ -std=c++11 -I/usr/local/opencv4/include -o out main.cpp -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui

in general, there is a library file to link for each module you include in your code, e.g.

#include "opencv2/face.hpp"

would require an additional:

-lopencv_face

on your cmdline

How to solve this issue?

you have to LINK the opencv libraries to your program, like:

g++ -std=c++11 -o out main.cpp -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui

for openv4, opencv4, you also need to correct the INCLUDE path:

g++ -std=c++11 -I/usr/local/opencv4/include -I/usr/local/include/opencv4 -o out main.cpp -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui

in general, there is a library file to link for each module you include in your code, e.g.

#include "opencv2/face.hpp"

would require an additional:

-lopencv_face

on your cmdline