📜  main.cpp:(.text+0x51): 未定义引用`cv::imread(std::__cxx11::basic_string <char, std::char_traits<char> , 标准::分配器<char>&gt; const&amp;, int)&#39; - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:53.464000             🧑  作者: Mango

代码示例2
--> My custom command that live sin my /usr/bin folder , that runs my cv2 cpp files  just fine without any problems  
 --> that may help someone 

#!/bin/bash 

file=$@

if [ "${file: -4}" = ".cpp"  ]; then 
        g++ $file -I/opt/robots/pepper/ctc-linux64-atom-2.5.10.7/opencv2/include/ -L/opt/robots/pepper/ctc-linux64-atom-2.5.10.7/opencv2/lib -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_videoio 
    if $status ; then 
        ./a.out && rm -rf a.out
    fi
else
    echo "This Command should be used only with cpp files that uses the opencv library !!"
fi