c++ - Eclipse 显示错误,但 gcc 编译正常

标签 c++ eclipse ide eclipse-cdt

我有这个 MCVE:

#include <stdio.h>
#include <string>
#include <vector>

auto wrapperMain( const std::vector<std::string> & commandLineArguments ) -> void
{
    printf( "argc=%d\n", commandLineArguments.size() );
}

int main( int argc, char * argv [] )
{
    wrapperMain( { argv, argv + argc } );
//  ^^^^^^^^^^^^ <- Eclipse does not like this
}

它使用 C++17 的最高警告和迂腐选项与 gcc 7.3 编译良好[即使它不是 C++17 功能]。

Eclipse 在 wrapperMain 下划线并显示此错误消息:

Invalid arguments '
Candidates are:
void wrapperMain(const std::vector<std::__cxx11::basic_string
   <char,std::char_traits<char>,
   std::allocator<char>>,std::allocator<std::__cxx11::basic_string
   <char,std::char_traits<char>,
   std::allocator<char>>>> &)
'

我知道我可以使用 Eclipse @suppress 指令禁用此下划线错误:

wrapperMain( { argv, argv + argc } );//@suppress("无效参数")

但我想一般性地修复它。

我的问题:这是 Eclipse 错误还是缺少设置?

最佳答案

这几乎肯定是 Eclipse CDT 中的一个错误。我提交了bug 531322进行跟踪。

更新:该错误现已修复。

关于c++ - Eclipse 显示错误,但 gcc 编译正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48852557/

相关文章:

java - 如何强制 Eclipse 换行?

java - Eclipse Mars DDMS 仅显示 Level 中的第一个字母,没有消息

ruby - 是否存在适用于 Ruby 的(实验性)类浏览器?

c++ - 为什么 boost 没有 make_scoped()?

c++ - 在没有 new 和 delete 关键字的情况下编写 C++?最好的方法?

c++ - 存在重载命名空间函数时需要 std::qualifier 吗?

c++ - C 程序会在 C++ 工作区中编译吗?

c++ - 在 std::vector 中实例化对象时出现错误 C2280/复制构造函数问题?

eclipse - 为 Eclipse 安装检查样式插件时出错

sql-server - 如何使用 Emacs 连接到 SQL Server?