gpt4 book ai didi

c++ - Eclipse CDT's symbol 'X' 无法解析的通用解决方案?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:23:42 24 4
gpt4 key购买 nike

我有一个包含 C++ 和 C 文件的项目。代码可以正确编译和运行,但我需要消除以下错误:

Symbol 'ERANGE' could not be resolved

我能够用这两个文件重现它(Ubuntu 上最新的 x64 Elipse Juno):

主要.h:

#ifndef MAIN_H_
#define MAIN_H_

extern "C" {
#include <errno.h>
}

#endif /* MAIN_H_ */

主要.cpp:

#include <cerrno>
#include <cassert>
#include "main.h"

int main(int argc, char * argv[]) {
assert(errno != ERANGE); // <-- CDT ERROR here
return 0; }

在 ERANGE 上正确执行 Open Declaration 会将我带到/usr/include/asm-generic/errno-base.h 文件。

类似问题的以下解决方法无效:

  • 设置 Indexer -> 使用事件构建配置
  • 手动将 ERANGE 符号添加到项目路径和符号
  • 将 main.cpp 添加到 Preferences -> C/C++ -> Code Analysis -> Symbol is not resolved -> Customize Selected... -> Scope -> Exclusion patterns

唯一可行的解​​决方案是完全禁用 Symbol is not resolved 错误,但这会导致我错过真正的问题。

编辑:已提交 CDT 错误 https://bugs.eclipse.org/bugs/show_bug.cgi?id=404017

最佳答案

看起来像是 Eclipse CDT 代码分析工具 (codan) 中的错误。我建议提交错误报告 here .

关于c++ - Eclipse CDT's symbol 'X' 无法解析的通用解决方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15504213/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com