我有这个MCVE:
update
使用g ++ 7.3使用C ++ 17的最高警告和迂腐选项编译好[即使它不是C ++ 17功能]。
Eclipse强调const update = (cb = null) => {
Price.remove({}, (err, remove) => {
if (err) {
return logger.error(`Error removing items...`);
}
logger.info(`Removed all items... Beginning to update.`);
_request(urls, (responses) => {
let url, response, gameid;
for (url in responses) {
gameid = url.split('/')[5].split('?')[0];
response = responses[url];
if (response.err) {
logger.error(`Error in request to ${url}: ${err}`);
return;
}
if (response.body) {
logger.info(`Request to ${url} successful.`)
let jsonResult = {};
try {
jsonResult = JSON.parse(response.body);
} catch (e) {
logger.error(`Could not parse.`);
}
logger.info(`Response body for ${gameid} is ${Object.keys(jsonResult).length}.`);
let allItemsArray = Object.keys(jsonResult).map((key, index) => {
return {
game_id: gameid,
market_hash_name: key,
price: jsonResult[key]
}
});
let bulk = Price.collection.initializeUnorderedBulkOp();
allItemsArray.forEach(item => {
bulk.find({market_hash_name: item.market_hash_name})
.upsert().updateOne(item);
});
bulk.execute((err, bulkers) => {
if (err) {
return logger.error(`Error bulking: ${e}`);
}
logger.info(`Updated Items for ${gameid}`)
});
// Price.insertMany(allItemsArray).then(docs => {
// logger.info(`Saved docs for ${gameid}`)
// }, (e) => {
// logger.error(`Error saving docs.`);
// });
}
}
if (cb && typeof cb == 'function') {
cb();
}
})
});
}
并显示以下错误消息:
#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
}
我知道我可以使用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错误还是缺少设置?