Ask Your Question

Revision history [back]

I don't think you should be giving the header files' directory explicitly (the -I/usr/include/opencv4 option), because pkg-config does that for you. The --libs part of pkg-config supplies the .so files, and --cflags part supplies the .h an .hpp files.

In summary, use this command:

g++ -g `pkg-config --libs --cflags opencv4` rgb.cpp

You might want to locate the opencv4.pc file in your filesystem (find / -type f -regex '^.*opencv4.pc$'), and inspect it's contents (cat /path/to/opencv4.pc), to better understand what I explained in the first paragraph.