【OpenCV】undefined reference to `cv::dnn::dnn4_v20191202::Net::~Net()‘
opencv
OpenCV: 开源计算机视觉库
项目地址:https://gitcode.com/gh_mirrors/opencv31/opencv
免费下载资源
·
Linux环境下使用opencv的dnn模块调用yolov4遇到的坑(纯CPU)
1. 改CMakeList.txt
向CMakeLists.txt中的
find_package(OpenCV 4 REQUIRED opencv_core opencv_imgproc opencv_highgui opencv_calib3d opencv_videoio opencv_imgcodecs )
添加opencv_dnn,即改成
find_package(OpenCV 4 REQUIRED opencv_core opencv_imgproc opencv_highgui opencv_calib3d opencv_videoio opencv_imgcodecs opencv_dnn )
2. 改Makefile
或者也可以直接在Makefile中添加编译选项
BUILD_FLAGS += -l opencv_dnn
3. Makefile中指定的OpenCV头文件和库文件的版本可能不匹配
我遇到的情况是,在makefile中指定opencv库文件路径是4.2.0的,但是指定的头文件路径是4.4.0的,所以它连cv::Mat::Mat()都是undefined,改成一致的就好了
如果用pkg-config配置好opencv环境的话,makefile这样写就不会遇到头文件库文件opencv版本不一致的问题:
CXX = aarch64-linux-gnu-g++
INCLUDE = $(shell pkg-config --cflags opencv4) #获得opencv相关头文件路径
LIBS = $(shell pkg-config --libs opencv4) #获得opencv扩展库。
SOURCES = test.cpp
TARGET = test
$(TARGET):$(SOURCES)
@$(CXX) -std=c++11 -O1 -o $(TARGET) $(SOURCES) $(INCLUDE) $(LIBS)
clean:
rm -rf $(TARGET) *.o
GitHub 加速计划 / opencv31 / opencv
77.39 K
55.71 K
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:2 个月前 )
48668119
dnn: use dispatching for Winograd optimizations 6 天前
3dace76c
flann: remove unused hdf5 header 6 天前
更多推荐
已为社区贡献3条内容
所有评论(0)