เรื่องของการ Compile โปรแกรมที่เรียกใช้ OpenCV

ถ้า compile ด้วยคำสั่งนี้ แล้วไม่ผ่าน

$ g++ -I/usr/include/opencv -lml -lcvaux -lhighgui -lcv -lcxcore  hello.cpp
/tmp/cchzFkVS.o: In function main':
hello.cpp:(.text+0x45): undefined reference to
cvLoadImage'
hello.cpp:(.text+0x6b): undefined reference to cvNamedWindow'
hello.cpp:(.text+0x7c): undefined reference to
cvShowImage'
hello.cpp:(.text+0x86): undefined reference to cvWaitKey'
hello.cpp:(.text+0x90): undefined reference to
cvDestroyWindow'
collect2: ld returned 1 exit status

ให้เปลี่ยนมา compile ด้วยคำสั่งนี้แทน

$ g++ hello.cpp -o hello pkg-config --cflags --libs opencv