g++ -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Iotdriver.d" -MT"Iotdriver.d" -o "Iotdriver.o" "../Iotdriver.cpp"
Finished building: ../Iotdriver.cpp
Building target: IOTpjt
Invoking: GCC C++ Linker
g++ -L/usr/local/lib -o "IOTpjt" ./Iotdriver.o -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_imgproc -lopencv_imgcodecs -lopencv_highgui -lopencv_calib3d -lopencv_flann -lopencv_objdetect
/usr/bin/ld: cannot find **-lopencv_contrib**
/usr/bin/ld: cannot find -**lopencv_legacy**
collect2: error: ld returned 1 exit status
make: *** [IOTpjt] Error 1
makefile:44: recipe for target 'IOTpjt' failed
答案1
根据搜索结果packages.ubuntu.com您需要安装以下软件包:
sudo apt install libopencv-contrib-dev libopencv-legacy-dev