我有这个 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/