未定义的对“精子”的引用

时间:2017-06-24 09:21:02

标签: c gcc

我安装了gcc-4.6.0并且我正在执行此操作的所有内容:http://pubs.opengroup.org/onlinepubs/009695399/functions/stat.html 我连接了所有包含并在代码中写道:

printf("%10.10s\n", sperm (statbuf.st_mode));

编译时出现了这样的错误:

 ls.c: In function 'main':
 ls.c:37:25: warning: comparison between pointer and integer [enabled by default]
 ls.c:68:9: warning: implicit declaration of function 'sperm' [-Wimplicit-function-declaration]
 ./ccmPDCcZ.o: In function `main':
 ls.c:(.text+0x238): undefined reference to `sperm'
 collect2: ld returned 1 exit status

我的代码:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>

#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <locale.h>
#include <langinfo.h>
#include <stdint.h>
int main()
{
  DIR *dir = opendir(".");
  if(dir)
  {
    struct dirent *ent;
    while((ent = readdir(dir)) != NULL)
    {
      if (stat(ent->d_name, &statbuf) == -1) //получаем инфу
        continue;
      if( (pwd=getpwuid(statbuf.st_uid)) != NULL)
      {
        printf("%-8.8s", pwd->pw_name);
      }
    }
  }
  else
  {
    fprintf(stderr, "Error opening directory\n");
  }
  return 0;
}

1 个答案:

答案 0 :(得分:1)

在相关代码的上下文中:

Validator::replacer('view_exists', function ($message, $attribute, $rule, $parameters, Validator $validator) {
    $value = array_get($validator->getData(), $attribute);

    return str_replace(':filename', $value, $message);
});

它似乎是一个将文件权限打印为字符串的功能。在这种情况下,您可以使用How do I print file permissions as a string?中描述的方法。

相关问题