IT Share you

빌드가 성공했지만 Netbeans 7.2에“Unable to resolve identifier”가 표시됨

shareyou 2020. 11. 30. 20:16
반응형

빌드가 성공했지만 Netbeans 7.2에“Unable to resolve identifier”가 표시됨


C / C ++ 플러그인 (마지막 버전 1.18.1.1)과 함께 Netbeans IDE 7.2사용하고 있으며 프로젝트를 빌드하면 모든 것이 정상이지만 IDE에 오류가 표시됩니다 (예 : 식별자를 확인할 수 없음 ...).

다른 사람이이 버그를 가지고 있으며 어떻게 해결할 수 있습니까?


다음은 다른 질문에 대한 제 답변에서 발췌 한 것입니다.

확인되지 않은 식별자

.cpp 파일의 소스가 다음과 같은 경우

여기에 이미지 설명 입력

프로젝트를 마우스 오른쪽 버튼으로 클릭합니다.
확인 C/C++ Code As...
실행Reparse Project.

여기에 이미지 설명 입력

충분하지 않다면. 설명 된대로 입력 필드 채우기로
이동합니다 .Project Properties
Include

여기에 이미지 설명 입력

포함 경로를 올바르게 설정하십시오.

도움이 되었기를 바랍니다.


TL; DR

UTF-8 WITH BOM도 문제를 일으킬 수 있습니다.

문제

나는 방금 똑같은 문제가 있었고 가능한 많은 해결책을 시도했지만 문제의 원인을 찾을 때까지 아무것도 작동하지 않았습니다. 이 질문에 대한 답은 이미 알고 있지만 내 해결책을 적어두면 같은 문제로 고통받는 다른 사람의 문제를 해결할 수있을 것입니다.

예를 들어,를 정의 할 때 "Unable to resolve identifier Vector" 가 표시 struct Vector되지만 정확했습니다.

식별자 벡터를 확인할 수 없습니다.

함수를 선언 / 정의 할 때 이와 비슷한 오류가 많이 발생했습니다. 또한 오류의 양 때문에 코드 지원이 작동하지 않았습니다.

해결책

  1. Notepad ++ 에서 .cpp파일을 열었고 파일이 일반 UTF-8 로 인코딩 되었음을 확인했습니다. 즉, 파일이 BOM (바이트 순서 표시) 문자로 시작됨 을 의미합니다 .

    메모장 ++-UTF-8 WITH BOM으로 인코딩 된 파일

  2. 그래서 EncodingConvert to UTF-8 without BOM을 클릭했습니다 .

    Notepad ++ : 인코딩-BOM없이 UTF-8로 변환

    참고 : 일부 특수 문자 (예 : 악센트가 포함 된 문자 등)를 엉망으로 만들 수 있으므로 "BOM없이 UTF-8로 인코딩"으로 전환하지 마십시오 . 그래서 그것을 변환 하십시오.

  3. 저장

  4. 문제가 사라짐 : NetBeans에서 더 이상 오류가보고되지 않음 :

    NetBeans-더 이상보고 된 오류 없음, 문제 해결

    다른 사람에게도 시간이 절약되기를 바랍니다.


i had the same problem, but i recognized it appears after i changed properties-> c++ compiler -> Compilation Line -> additional options to -std=c++11. if change the settings to default the error "unable to resolve identifier" disapears.


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.


I am using NetBeans 8.1 and the same problem popped up when I started a new C++ project. It solved itself after running the project through the debugger.


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.


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


I often have this error, and as others mentioned, usually I add space character, save the file, remove the space character... and all identifiers are solved.

This time it did not work. My project, which I compiled thousand times, and it always worked, suddenly crashed MPLAB X IDE v3.35 (Mac OSX, but likely it doesn't matter), while typing text. After this I have in one file only and for one structure only, all identifiers unresolved.

Structure in profile.h file was:

typedef struct
{
    int state;                      ///< state machine current state
    int enabled;                    ///< machine can be ENABLED or DISABLED
    int flag;                       ///< to initiate profile execution
   ... many variables here ...
    unsigned long timestamp;        ///< variable used for local timing
} profile_struct;

In my profile.c file any variables from this structure became unresolved, but project compiled and worked fine.

After a frustrating hour of trying, this solved my problem: Erased the whole MPLABX cache directory.

In my case, it is located at:

/Users/USER_NAME/Library/Caches/mplab_ide/dev/v3.35/var

(need to erase the whole 'var' directory; and of course replace the USER_NAME with your user name)

Note, that the 'Library' is a hidden directory, but you can still access it if you enable viewing hidden files, or go straight to it via terminal.

마지막으로 컴퓨터에서 다른 곳에있을 수 있습니다. 터미널 명령을 사용하여 지난 2 분 동안 내 컴퓨터에서 수정 된 파일을보고 내 것을 찾았습니다.

/usr/bin/find /Users/USER_NAME/ -mmin -2 –ls

파일을 마우스 오른쪽 버튼으로 클릭하고 속성-> 일반-> 코드 지원에서 제외 (비활성화)


내 main.c의 이름을 main.cpp로 바꾸면 내 것이 작동했습니다.

파일 확장자에 따라 Netbeans Code Assistance의 동작이 변경됩니다.

참고 URL : https://stackoverflow.com/questions/14913243/netbeans-7-2-shows-unable-to-resolve-identifier-although-build-is-successful

반응형