use bellow command build: $ g++ -o encryption encryption.cpp 'pkg-config opencv --cflags --libs' g++: error: pkg-config --cflags --libs opencv: No such file or directory but change "apostrophe(')" in command as "back quote(`)", then build success, as: $ g++ -o encryption encryption.cpp `pkg-config opencv --cflags --libs`