OS で libusb API をセットアップしようとしています。libusb.org で libusb api をダウンロードしました。標準のインストール手順に従いました。
cd into directory
./configure
make
make check //without errors
make install
次に、Eclipse C/C++ を起動し、インターネットで見つけたチュートリアルからいくつかのコードをコピーしました。しかし、それをビルドしようとすると、次の出力が得られました。
main.cpp:(.text+0x19): undefined reference to `libusb_init'
main.cpp:(.text+0x76): undefined reference to `libusb_set_debug'
main.cpp:(.text+0x8a): undefined reference to `libusb_get_device_list'
main.cpp:(.text+0x136): undefined reference to `libusb_free_device_list'
main.cpp:(.text+0x142): undefined reference to `libusb_exit'
/tmp/ccOWJGwe.o: In function `printdev(libusb_device*)':
main.cpp:(.text+0x162): undefined reference to `libusb_get_device_descriptor'
main.cpp:(.text+0x28a): undefined reference to `libusb_get_config_descriptor'
main.cpp:(.text+0x4d4): undefined reference to `libusb_free_config_descriptor'
collect2: ld returned 1 exit status
/lib に libusb.so があり、/usr/local/include に usb.h があり、/usr/local/lib に .so と libusb.a のリンクがあります。
コード内の #include も正しいです。
問題がリンカーにあることは知っていますが、私はそれを機能させることができません:)
Fedora 15 オペレーティング システムと gcc 4.6.0 20110603 (Red Hat 4.6.0-10) バージョンのコンパイラを使用しています。
では、これらの未定義の参照を解決するにはどうすればよいでしょうか? 助けてくれてどうもありがとう:)