Proper way to link a static library using GCC

后端 未结 4 808
逝去的感伤
逝去的感伤 2020-12-24 13:56

Why is it that some static libraries (lib*.a) can be linked in the same way that shared libraries (lib*.so) are linked (ld -l switch), but some can not?

I had always

4条回答
  •  渐次进展
    2020-12-24 14:59

    Have you cared to indicate to GCC the path of your library (using -L) ? By using -l solely, GCC will only be able to link libraries available in standard directories.

    -L[path] -l[lib]
    

提交回复
热议问题