且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

由于未定义的引用,无法编译 OpenCV?

更新时间:2022-01-11 21:43:18

这是一个链接器问题.试试:

This is a linker issue. Try:

g++ -o test_1 test_1.cpp `pkg-config opencv --cflags --libs`

这应该可以编译源代码.但是,如果您最近从源代码编译 OpenCV,您将在运行时遇到链接问题,将找不到该库.在大多数情况下,从源代码编译库后,您需要做最后的事情:

This should work to compile the source. However, if you recently compiled OpenCV from source, you will meet linking issue in run-time, the library will not be found. In most cases, after compiling libraries from source, you need to do finally:

sudo ldconfig