- 论坛徽章:
- 0
|
原书代码:
- #include <sys/types.h>
- #include <dirent.h>
- #include "ourhdr.h"
- int
- main(int argc,char *argv[])
- DIR *dp
- struct dirent *dirp;
-
- if (argc != 2)
- err_quit("a single argument (the directory name) is required");
- if ((dp = opendir(argv[1])) == NULL)
- err_sys("can't open %s",argv[1]);
- while ((dirp =readdir(dp)) != NULL)
- printf("%\n",dirp->d_name);
- closedir(dp);
- exit(0);
- }
复制代码
编译时,总是出现:
- /var/tmp//ccJsgUhB.O(.text+0x2b):in function main:
- undefined reference to 'err_quit'
- /var/tmp//ccJsgUhB.O(.text+0x5f):in function main:
- undefined reference to 'err_sys
复制代码
函数的原型是:
- void err_quit(const char *,...)
- void err_sys(const char *,...)
复制代码
请问这是什莫原因?谢谢 |
|