g++链接opencv时报错:
undefined reference to symbol ’ zN2cv6imreadERKNSt7__cxx1112basic stringIcst11char traitsIcEsaICEEEi’
/usr/lib/aarch64-linux-gnu/libopencv imgcodecs.so.4.5: error addingsymbols: Dso missing from command linecollect2:error:ldreturned 1exit status
也可以改用cmakelists.txt进行编译
首先创建cmakelists.txt,内容如下
cmake_minimum_required(VERSION 3.0)
project(YourProjectName)
# 查找OpenCV库
find_package(OpenCV REQUIRED)
# 将源代码添加到此项目的可执行文件。
add_executable(YourExecutableName main.cpp)
# 链接OpenCV库
target_link_libraries(YourExecutableName ${OpenCV_LIBS})
然后
mkdir build
cd build
cmake ..
make