Disable g++ quot;note candidates are..quot; compiler message(禁用 g++“注意候选项是..编译器消息)
问题描述
很多时候,当我编译有错字或其他类型不匹配的东西时,我会收到标准的错误:'functionname' in ..."错误.这很棒.然后,特别是在函数和运算符重载的情况下,g++ 继续列出 10 页的候选列表,它们只是可怕的海量模板定义.
Many times when I compile something with a typo or some other typing mismatch, I get the standard "error: no match for 'functionname' in ..." error. This is great. Then, especially in the case of overloaded functions and operators, g++ goes on and list like 10 pages of candidates which are just hideous and massive template definitions.
错误信息很好,但是有什么方法可以禁止它提示其他功能变体?
The error message is great, but is there any way to disable it from suggesting other functions variants?
推荐答案
据我所知,GCC 中没有编译标志可以在函数调用不明确的情况下禁用建议的候选.
As far as I know, there is no compilation flag in GCC to disable the suggested candidates in case of ambiguous function calls.
您唯一的希望可能是修补 GCC 源代码.
Your only hope is perhaps to patch the GCC source code.
深入研究(版本:4.7.1),我发现 gcc/cp/pt.c 中似乎是相关函数:
p>
Digging in it (version: 4.7.1), I've found what appear to be the relevant function in gcc/cp/pt.c
:
void
print_candidates(tree fns)
{
const char *str = NULL;
print_candidates_1 (fns, false, &str);
gcc_assert (str == NULL);
}
作为一个有根据的猜测,我认为您只需要注释掉函数体.
As an educated guess, I think that you only need to comment out the function body.
这篇关于禁用 g++“注意候选项是.."编译器消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:禁用 g++“注意候选项是.."编译器消息


基础教程推荐
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 常量变量在标题中不起作用 2021-01-01