Unable to resolve identifier on netbeans

牧云@^-^@ 提交于 2019-12-01 17:02:33

问题


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;
}

回答1:


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.



来源:https://stackoverflow.com/questions/6199384/unable-to-resolve-identifier-on-netbeans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!