我在 Ubuntu 15.04 上使用 Eclipse Mars CDT 编写一些 C 代码。
Eclipse 报错如下:
但 Eclipse 似乎知道 RLIMIT_NPROC
扩展为 __RLIMIT_NPROC
.我可以使用 Ctrl+Click
跳转到哪里RLIMIT_NPROC
已定义,即 /usr/include/i386-linux-gnu/bits/resource.h
.
在该文件中,__RLIMIT_NPROC
仅在宏声明上方的一行定义。 eclipse 如何找到 RLIMIT_NPROC
但找不到 __RLIMIT_NPROC
??? 见下文:
还有我的项目Inclueds
看起来像这样:
加1
添加以下行可以解决符号问题:
#include <bits/resource.h>
但是编译失败了:
我更改为包含 <sys/resource.h>
根据要求,符号问题再次出现......
一切对我来说都很完美。我创建“C 项目”(文件->新建->C 项目->Hello world ANSI C 项目)并插入此代码:
#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/time.h>
int main(void) {
struct rlimit t;
getrlimit(RLIMIT_NPROC, &t);
return EXIT_SUCCESS;
}
我是一名优秀的程序员,十分优秀!