zoukankan      html  css  js  c++  java
  • Linux下ld搜索问题:ld: cannot find -l"XX"

    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

  • 相关阅读:
    浅谈 倍增/ST表
    Meetings S 题解
    排序模板
    Huffman 树
    2020.7.31 模拟赛 题解
    浅谈 最短路
    【lcez校内第三次考T1】【题解】folder
    【题解】 P2613 【模板】有理数取余
    【题解】P5535 【XR-3】小道消息
    【笔记】积性函数 与 欧拉函数
  • 原文地址:https://www.cnblogs.com/foohack/p/4040498.html
Copyright © 2011-2022 走看看