为什么 std::for_each 不使用 minGW 编译?

Why doesn't std::for_each compile with minGW?

本文关键字:minGW 编译 each std for 为什么      更新时间:2023-10-16

我试图用MinGW编译器在Qt上编译这行,使用QVector<double>std::for_each函数。

std::for_each(data.begin(), data.end(), [max](double& n){ n/=max;});

我得到这个错误:

错误:没有匹配函数调用for_each(QVector::iterator, QVector::iterator, normalize(QVector&)::)'(max) (double&n) {n/= max;});^

在MVSC2013 32位下可以正确编译

我找到了解决方案。你必须使用c++ 11。

使用c++ 11修复。