Qt5 中使用 C++11

学习别人的代码,运行时报错

warning: lambda expressions only available with -std=c++11 or -std=gnu++11 [enabled by default]
});
^
error: no matching function for call to ‘QObject::connect(QProcess*&, void (QIODevice::*)(), qMain(int, char**)::__lambda0)’
});
^

应该是没有打开C++11选项。在 .pro 文件中添加  CONFIG += c++11 即可。

扩展阅读:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.