How to link to a static library in C?

前端 未结 5 778
旧巷少年郎
旧巷少年郎 2020-12-01 03:54

I use code::blocks to compile my static library. The output result is a libstatic.a file. Now, how do I link to my library to use functions that were compiled?

(I

5条回答
  •  既然无缘
    2020-12-01 04:08

    I had to set the library path in my makefile. For this case you could use:

    gcc -o myapp main.c -L. -lstatic
    

提交回复
热议问题