Cpp file compilation ERROR. (NVIDIA JETSON TX2, OpenCV 4.1.0)

hello everyone,
I am working with Nvidia Jetson TX2 for my project. I have a few Cpp file with me which I want to compile. and I am getting following errors.

nvidea@tegra-ubuntu: /Desktops g++ Project.cpp -o Project $ (pkg-config cflags --libs opencv)
/tmp/ccehoQft.o: In function ‘main’:
Project.cpp :(. text + 0x38): undeftned reference to ‘cv :: videocapture :: videocapture (int)’
Project.cpp :(. text + 0xb0): undeftned reference to ‘cv :: tnshow (cv :: Strtng const &, CV :: InputArray const &)’
/ tmp / ccehoQft.o: In function cv :: String: String (char const *) ':
Project.cpp: (.text. ZN2cv6StrtngcZEPKe [ZN2cv6stringCSEPKc] + 0x4c) undeftned reference to ‘cv :: String: allocate (unsigned long) "
/tmp/ccehoQft.o: In function ‘cv::string::-string()’:
Project.cpp :(.Text.ZN2ev6Stringo2Ev[_zN2ev6strtngosev] + 0x10 ): undeftned reference to "cv :: String: deallocate ()’
collect2: error ld returned 1 exit status


i would be greatful for your help and solution for the same.

thank you in advance


You probably need to have libopencv-videoio-dev installed, check if its being included running:

pkg-config --libs opencv