Linux下ld搜尋問題:ld: cannot find -l"XX"

來源:互聯網
上載者:User

標籤:http   io   os   ar   sp   檔案   on   問題   bs   

ld命令列工具(連結庫的一個工具)的搜尋路徑是-L指定的,庫名是-l指定的。

 

比如: ld -L[dir] -l[mylib] --verbose

以上我用可視化的方法顯示ld的搜尋路徑,其結果是居然在mylib,也就是庫檔案名稱中自動加入了首碼lib,導致找不到我的mylib,因為我的lib名字沒有加入lib的首碼。所以要把庫名改了,加上lib首碼。我操,ld這樣的設計目的是什嗎?加入首碼是為了減少衝突機率嗎???類似很多第三方庫的API也是有自己的首碼,比如openGL就有gl的首碼,就是為了減少衝突。

 

ld -L/home/a/dls/dls/trunk/dlf/pc/lib -lkp_wdapi1160_gcc_v3 --verbose

attempt to open /home/a/dls/dls/trunk/dlf/pc/lib/libkp_wdapi1160_gcc_v3.so failed
attempt to open /home/a/dls/dls/trunk/dlf/pc/lib/libkp_wdapi1160_gcc_v3.a failed
attempt to open /usr/x86_64-linux-gnu/lib64/libkp_wdapi1160_gcc_v3.so failed
attempt to open /usr/x86_64-linux-gnu/lib64/libkp_wdapi1160_gcc_v3.a failed
attempt to open /usr/local/lib/x86_64-linux-gnu/libkp_wdapi1160_gcc_v3.so failed
attempt to open /usr/local/lib/x86_64-linux-gnu/libkp_wdapi1160_gcc_v3.a failed
attempt to open /usr/local/lib64/libkp_wdapi1160_gcc_v3.so failed
attempt to open /usr/local/lib64/libkp_wdapi1160_gcc_v3.a failed
attempt to open /lib/x86_64-linux-gnu/libkp_wdapi1160_gcc_v3.so failed
attempt to open /lib/x86_64-linux-gnu/libkp_wdapi1160_gcc_v3.a failed
attempt to open /lib64/libkp_wdapi1160_gcc_v3.so failed
attempt to open /lib64/libkp_wdapi1160_gcc_v3.a failed
attempt to open /usr/lib/x86_64-linux-gnu/libkp_wdapi1160_gcc_v3.so failed
attempt to open /usr/lib/x86_64-linux-gnu/libkp_wdapi1160_gcc_v3.a failed
attempt to open /usr/lib64/libkp_wdapi1160_gcc_v3.so failed
attempt to open /usr/lib64/libkp_wdapi1160_gcc_v3.a failed
attempt to open /usr/local/lib/libkp_wdapi1160_gcc_v3.so failed
attempt to open /usr/local/lib/libkp_wdapi1160_gcc_v3.a failed
attempt to open /lib/libkp_wdapi1160_gcc_v3.so failed
attempt to open /lib/libkp_wdapi1160_gcc_v3.a failed
attempt to open /usr/lib/libkp_wdapi1160_gcc_v3.so failed
attempt to open /usr/lib/libkp_wdapi1160_gcc_v3.a failed
ld: cannot find -lkp_wdapi1160_gcc_v3

 

 

reference:

http://stackoverflow.com/questions/16710047/usr-bin-ld-cannot-find-lnameofthelibrary

Linux下ld搜尋問題:ld: cannot find -l"XX"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.