问题描述
我刚刚开始阅读这本书:并尝试编译第一个示例代码,与中的代码相同。
虽然编译问题可以通过命令来解决:
gcc - o myls myls.c -I SCADDRESS / include / -L SCADDRESS / lib / -lapue
任何人都可以解释一下吗? Thx提前:)
我刚刚开始阅读这本书:并尝试编译第一个示例代码,与中的代码相同。
虽然编译问题可以通过命令来解决:
gcc - o myls myls.c -I SCADDRESS / include / -L SCADDRESS / lib / -lapue
任何人都可以解释一下吗? Thx提前:)
这是记录在§ 2.13GCC手册中的链接选项:
I have just began reading the book: Advanced Programming in Unix Enviornment and try to compile the first example code, just the same as in this thread.Although the problem for the compilation is solved using the command:
gcc -o myls myls.c -I SCADDRESS/include/ -L SCADDRESS/lib/ -lapue
I looked it up in the GCC manual and can't find what does the gcc option -lxxx mean, where xxx stands for the base name of a header file(in this case, it's apue.h). According to the manual, xxx should be some library files, either end with .so for shared object files, or with .a for static libraries.
Can anyone explain it a little bit? Thx in advance:)
This is documented in §2.13 "Options for Linking" in the GCC manual:
这篇关于gcc中的-l选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!