Build error: Missing pkg-config, in Code::Blocks IDE on Raspberry Pi

  1. Open CV has been installed on my Raspberry Pi 4.

  2. A check confirms that the latest version of Libopencv-dev is installed (4.6.0+dfsg-12).

  3. I am using the Code::Blocks IDE to devlop in C++.

  4. It is configured the use the Default CMake build tool.

  5. When trying to link to OpenCV4 library files from Code::Blocks IDE, I get the following error:
    g++ -L/usr/include/opencv4/ -L/usr/include/opencv4/opencv2/ -o bin/Release/TestCamera obj/Release/SimpleGrab.o ‘pkg-config --libs --cflags opencv4’ ‘pkg -config - - libs - -cflags opencv4’ -s

  6. I think this error may imply it cannot find the ‘pkg-config’.
    I am clearly missing something as the Pi is relatively new to me. so any help would be really appreciated.