#include "apue.h"
#include <dirent.h>
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("%s\n", dirp->d_name);
closedir(dp);
exit(0);
}
I downloaded apue.h file and it is in the current directory as my source file. when I try to compile with clang and OS X the following error occurs.
1 warning generated.
Undefined symbols for architecture x86_64:
"_err_quit", referenced from:
_main in lsnew-cbcc3e.o
"_err_sys", referenced from:
_main in lsnew-cbcc3e.o
ld: symbol(s) not found for architecture x86_64
clang error: linker command failed with exit code 1 (use -v to see invocation)
Can someone steer me in the right direction as to what is wrong? does this code only work on 32bit systems?
thanks.