Proper way to link a static library using GCC

后端 未结 4 783
逝去的感伤
逝去的感伤 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:42

    Thanks for the replies! Turns out the problem was due to link order. Apparently, if you use a library which in turn has other library dependencies, those other dependencies must be listed after the library, not before as I had been doing. Learned something new!

提交回复
热议问题