禁用g ++“注释候选者为".编译器消息 [英] Disable g++ "note candidates are.." compiler message

查看:89
本文介绍了禁用g ++“注释候选者为".编译器消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多时候,我用错别字或其他类型的输入不匹配来编译某些内容时,都会收到标准的错误:...中的'functionname'不匹配"错误.这很棒.然后,特别是在函数和运算符重载的情况下,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中似乎与之相关的功能:

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 ++“注释候选者为".编译器消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆