빌드가 성공했지만 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 PropertiesInclude

포함 경로를 올바르게 설정하십시오.
도움이 되었기를 바랍니다.
TL; DR
UTF-8 WITH BOM도 문제를 일으킬 수 있습니다.
문제
나는 방금 똑같은 문제가 있었고 가능한 많은 해결책을 시도했지만 문제의 원인을 찾을 때까지 아무것도 작동하지 않았습니다. 이 질문에 대한 답은 이미 알고 있지만 내 해결책을 적어두면 같은 문제로 고통받는 다른 사람의 문제를 해결할 수있을 것입니다.
예를 들어,를 정의 할 때 "Unable to resolve identifier Vector" 가 표시 struct Vector되지만 정확했습니다.

함수를 선언 / 정의 할 때 이와 비슷한 오류가 많이 발생했습니다. 또한 오류의 양 때문에 코드 지원이 작동하지 않았습니다.
해결책
Notepad ++ 에서
.cpp파일을 열었고 파일이 일반 UTF-8 로 인코딩 되었음을 확인했습니다. 즉, 파일이 BOM (바이트 순서 표시) 문자로 시작됨 을 의미합니다 .
그래서 Encoding → Convert to UTF-8 without BOM을 클릭했습니다 .

참고 : 일부 특수 문자 (예 : 악센트가 포함 된 문자 등)를 엉망으로 만들 수 있으므로 "BOM없이 UTF-8로 인코딩"으로 전환하지 마십시오 . 그래서 그것을 변환 하십시오.
저장
문제가 사라짐 : 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의 동작이 변경됩니다.
'IT Share you' 카테고리의 다른 글
| Python을 사용하여 Selenium Chrome 드라이버에 옵션을 전달하려면 어떻게해야합니까? (0) | 2020.11.30 |
|---|---|
| 파이썬 요청 requests.exceptions.SSLError : [Errno 8] _ssl.c : 504 : EOF가 프로토콜 위반으로 발생했습니다. (0) | 2020.11.30 |
| Jenkins의 다른 작업에서 특정 빌드 번호를 승격하는 방법은 무엇입니까? (0) | 2020.11.30 |
| Composer 및 autoload.php를 사용하여 PHPUnit의 클래스 자동로드 (0) | 2020.11.30 |
| ToString ( "N0") 형식이란 무엇입니까? (0) | 2020.11.30 |