无法解析 netbeans 上的标识符

发布于 2024-11-11 14:29:50 字数 343 浏览 4 评论 0原文

我在 netbeans 上不断收到“无法解析标识符文件”消息。 我是 c 和 netbeans 的新手。 昨晚很好,但不知何故,重新启动计算机后,此消息不断出现。 这是一个代码。会出现什么问题呢?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char** argv) {
  char filename[] = "text.dat";
  char line[5];
  FILE *file = fopen(filename, "r");
  return 0;
}

I'm keep getting this "Unable to resolve identifier file" message on netbeans.
I'm new in c and netbeans.
It was fine last night but somehow after rebooting my computer this message keep occurs.
Here's a code. What would be the problem?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char** argv) {
  char filename[] = "text.dat";
  char line[5];
  FILE *file = fopen(filename, "r");
  return 0;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请远离我 2024-11-18 14:29:50

我知道这是一篇旧帖子,但今天我遇到了同样的问题。不要太快地假设编译器提供的头文件有缺陷。这种情况很少发生,特别是对于像 stdio.h 这样已经存在很长时间的头文件。

请记住,Netbeans 代码帮助引用源代码中使用的包含内容。编译器使用的任何宏都必须定义到 Netbeans。 stdio.h 等文件可能具有基于一个或多个宏的条件包含。除非 Netbeans 知道这些宏,否则它在处理包含文件以提供代码帮助时无法应用它们。这将阻止加载包含符号的条件标头。

例如,今天我看到我使用的包含文件有许多条件包含,并且 Netbeans 报告它无法解析的符号是在这些文件中定义的。知道我正在为特定处理器构建,我确定了将正确文件包含在 .然后我在项目属性/代码帮助/C 编译器/预处理器定义中定义了该宏。此时 Netbeans 能够解析这些符号。

I know this is an old post, but I ran into the same issue today. Don't be too quick to assume a compiler-supplied header file is defective. That is rarely the case, especially for headers such as stdio.h that have been around a long time.

Keep in mind that Netbeans code assistance references the includes used within your source code. Any macros that are used by the compiler must be defined to Netbeans. A file such as stdio.h may have conditional includes based on one or more macros. Unless Netbeans is aware of those macros it cannot apply them when it processes include files to provide code assistance. This would prevent conditional headers containing symbols from being loaded.

For example, today I saw that an include file I use has many conditional includes and the symbols Netbeans reported it could not resolve were defined in those files. Knowing that I was building for a particular processor I determined the macro needed for the proper file to be included within . I then defined that macro in Project Properties/Code Assistance/C Compiler/Preprocessor Definitions. At that point Netbeans was able to resolve the symbols.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文