OpenCV の VideoCapture の例をコンパイルしようとしていました。コンパイルすると、次の出力が得られます。
gpp test.c
Info: resolving vtable for cv::VideoCapture by linking to __imp___ZTVN2cv12VideoCaptureE (auto-import)
c:/programs/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: auto-importing has
enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
(ちなみに、gpp は g++ -lhighgui -lcv -lcxcore のエイリアスです)
そこで、「gpp --enable-auto-import」でコンパイルしてみましたが、g++ はこのオプションを認識しませんでした。ということで、以下のようにコンパイルしてみました。
gpp -c test.c
ld test.o
そして、同じエラーとSTL関数に関する他の多くのエラーがあり、STLとリンクしていないことを示しています:
undefined reference to std::cout
...
そして、最後に、次のようにコンパイルすると:
gpp -c test.c
ld --enable-auto-import test.o
今回は、STL エラーのみを取得しました。VideoCapture エラーがなくなりました。だから私はこの問題を解決したと思います。唯一のことは、自分のプログラムを ld に STL ライブラリとリンクさせるにはどうすればよいかということです??????
前もって感謝します