Gio*_*ano 5 c gcc posix stat c11
这是我第一次使用posix; 包括我:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Run Code Online (Sandbox Code Playgroud)
我有这个片段.
stat(pathname, &sb);
if ((sb.st_mode & S_IFMT) == S_IFREG) {
/* Handle regular file */
}
Run Code Online (Sandbox Code Playgroud)
但如果我使用-std = c99或-std = c11或-std = gnu99或-std = gnu11编译,则在Gentoo上使用GCC 4.8.3我收到此错误:
error: ‘S_ISFMT’ undeclared (first use in this function)
Run Code Online (Sandbox Code Playgroud)
如果我省略-std =*我没有错误.但我也想要-std = c99的所有功能(如关键字restrict或for(int i ;;)等...)我怎样才能编译我的代码?
| 归档时间: |
|
| 查看次数: |
3397 次 |
| 最近记录: |