且构网

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

OpenCV 2.3 编译问题 - 未定义参考 - Ubuntu 11.10

更新时间:2022-04-29 23:47:54

我猜至少有一些库在

pkg-config opencv --libs

是档案库.将存档库放在需要它们的源之前是不正确的(在这种情况下为 test_1.cpp):链接行上源和库的顺序 很重要.

are archive libraries. It is incorrect to put archive libraries before sources that need them (test_1.cpp in this case): the order of sources and libraries on the link line matters.

试试

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