Makefile 将一个文件链接到依赖于另一个文件的文件
我有一个依赖test2.c的文件test1.c,这又取决于libcurl(curl.h) 在我的制作中,当我这样做的时候 gcc test1.o test2.o, 在将test1链接到test2时,它给出了错误 - 对test2.c中使用的所有curl方法的未定义引用。
我如何使test1.c继承test2.c的所有依赖关系,而无需明确执行gcc test1.o test2.o -lcurl
I have a file test1.c which depends on test2.c, which in turn depends on libcurl(curl.h)
In my makefile, when I do
gcc test1.o test2.o,
while linking test1 to test2, it gives error - undefined reference to all the curl methods used in test2.c.
How do I make test1.c inherit all the dependencies of test2.c without explicitly having to do gcc test1.o test2.o -lcurl
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Makefile 提供了许多小快捷方式,如果您需要的话,可以更轻松地完成工作。
There are many little shortcuts that Makefile provides that make it easier to get the job done if that is what you are asking.