gpt4 book ai didi

c - Eclipse CDT - 无法解析符号 `__RLIMIT_NPROC`

转载 作者:太空宇宙 更新时间:2023-11-04 10:47:34 25 4
gpt4 key购买 nike

我在 Ubuntu 15.04 上使用 Eclipse Mars CDT 编写一些 C 代码。

Eclipse 报错如下:

enter image description here

但 Eclipse 似乎知道 RLIMIT_NPROC扩展为 __RLIMIT_NPROC .我可以使用 Ctrl+Click跳转到哪里RLIMIT_NPROC已定义,即 /usr/include/i386-linux-gnu/bits/resource.h .

在该文件中,__RLIMIT_NPROC仅在宏声明上方的一行定义。 eclipse 如何找到 RLIMIT_NPROC但找不到 __RLIMIT_NPROC ??? 见下文:

enter image description here

还有我的项目Inclueds看起来像这样:

enter image description here

加1

添加以下行可以解决符号问题:

#include <bits/resource.h>

但是编译失败了:

enter image description here

我更改为包含 <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;
}

关于c - Eclipse CDT - 无法解析符号 `__RLIMIT_NPROC`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32424808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com