当前位置: 技术问答>linux和unix
unix环境高级编程2 源代码使用问题
来源: 互联网 发布时间:2015-12-23
本文导语: 我现在运行unix环境高级编程2 中的源代码,比如如下: #include "apue.h" #include int main(int argc, char *argv[]) { DIR *dp; struct dirent *dirp; if (argc != 2) err_quit("usage: ls directory_name"); if ((dp = opendir(argv[1])) == NULL) e...
我现在运行unix环境高级编程2 中的源代码,比如如下:
#include "apue.h"
#include
int main(int argc, char *argv[])
{
DIR *dp;
struct dirent *dirp;
if (argc != 2)
err_quit("usage: ls directory_name");
if ((dp = opendir(argv[1])) == NULL)
err_sys("can't open %s", argv[1]);
while ((dirp = readdir(dp)) != NULL)
printf("%sn", dirp->d_name);
closedir(dp);
exit(0);
}在我的工作目录中,我将apue.h头文件放入了,可是编译时提示 undefined reference to 'err_quit'和undefined reference to 'err_sys',请问这是为什么啊
#include "apue.h"
#include
int main(int argc, char *argv[])
{
DIR *dp;
struct dirent *dirp;
if (argc != 2)
err_quit("usage: ls directory_name");
if ((dp = opendir(argv[1])) == NULL)
err_sys("can't open %s", argv[1]);
while ((dirp = readdir(dp)) != NULL)
printf("%sn", dirp->d_name);
closedir(dp);
exit(0);
}在我的工作目录中,我将apue.h头文件放入了,可是编译时提示 undefined reference to 'err_quit'和undefined reference to 'err_sys',请问这是为什么啊
|
complile with apue.c
>> gcc youfile.c apue.c
>> gcc youfile.c apue.c
|
At the section Appendix B. Miscellaneous Source Code, part B.2 Standard Error Routines, please combine the following sources codes as apue.c
Figure B.3. Error functions that output to standard error
Figure B.4. Error functions for daemons
Regards
Figure B.3. Error functions that output to standard error
Figure B.4. Error functions for daemons
Regards
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。