Netbeans 7.2 shows “Unable to resolve identifier” , although build is successful

后端 未结 11 538
野的像风
野的像风 2020-11-28 21:54

I\'m using the Netbeans IDE 7.2 with C/C++ plugin (last version 1.18.1.1) and if I build my project everything is fine but the IDE show me

相关标签:
11条回答
  • 2020-11-28 22:04

    I recently had this error with netbeans 8.0.2 on OS X, and couldn't find an answer for what to do.

    I solved the problem by uninstalling the C/C++ plug-in, when I reopened netbeans it prompted me to 'fix code assistance..'.

    Clicking the prompt and letting it run the problem was fixed.

    0 讨论(0)
  • 2020-11-28 22:04

    Three ways to solve the issue of "unable to resolve identifier" error in Netbeans 12.

    1. Right click on "Project". Select "Code Assistance". Clean C/C++ cache. Restart IDE.
    2. Right click "Project properties"---> go to build--> under C/c++ compiler, set both your C and C++ compiler to the same standard, on every C/C++ project.
    3. Under tools--> options--> C/C++-->code assistance, change:__cplusplus=199711L to:__cplusplus=201402L for C++14 or to __cplusplus=201103L for C++11

    I realised while resolving my own problem, the proper/aligned enclosing braces could cause the above error. Make sure your braces are balanced and aligned.

    0 讨论(0)
  • 2020-11-28 22:05

    We develop our code on one computer and compile on another. I was getting these distracting markups until I "set Build Host" to the remote machine (in the right-click menu for the project).

    I'm still not sure what the problem on the development computer was, since the unresolved identifiers were things from the standard library (size_t, std::vector etc) and the answers here didn't seem to help.

    0 讨论(0)
  • 2020-11-28 22:15

    TL;DR

    UTF-8 WITH BOM can cause problems too.

    PROBLEM

    I just had the same problem, and I tried lots of possible solutions, but none of them worked, until I found out the source of the problem, which was a bit funny. I know this question has already been answered, but I write down my solution, maybe it will solve the problem of someone else suffering from the same problem.

    For example, I got "Unable to resolve identifier Vector" when defining struct Vector, while it was correct:

    Unable to resolve identifier Vector

    I got many errors similar to this when declaring/defining functions, etc. Additionally, my code assistance didn't work because of the amount of errors.

    SOLUTION

    1. I opened the .cpp file in Notepad++, and saw the file was encoded in regular UTF-8, which means that the file begins with the byte order mark (BOM) character:

      Notepad++ - file encoded in UTF-8 WITH BOM

    2. So I clicked EncodingConvert to UTF-8 without BOM:

      Notepad++: Encoding - Convert to UTF-8 without BOM

      Note: do NOT just switch to "Encode in UTF-8 without BOM", because it can mess up some special characters (e.g. characters containing accents, etc.). So convert it.

    3. Save

    4. Problem gone: no errors reported in NetBeans anymore:

      NetBeans - no errors reported anymore, problem solved

      I hope it saves some time for someone else too.

    0 讨论(0)
  • 2020-11-28 22:16

    I always have to reinstall MPLAB X when this happens. Other things work from time to time, but that always works.

    0 讨论(0)
提交回复
热议问题