如何在NetBeans 8.1中正确配置g ++编译器以获得c ++ 11/c ++ 14支持? [英] How to configure g++ compiler in netbeans 8.1 correctly for c++11/c++14 support?

查看:112
本文介绍了如何在NetBeans 8.1中正确配置g ++编译器以获得c ++ 11/c ++ 14支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手,正在通过stroustrup使用c ++进行编程原理和实践……我正在使用Netbeans ide 8.1,并且存在以下问题:

I'm a novice and work my way through Programming Principles and Practise using c++ by stroustrup ... I'm using Netbeans ide 8.1 and have a problem with the following:

#include "std_lib_facilities.h"
int main()
{
vector<int> v = {0,1,2,3,4,5,6};
for(int i = 0; i < v.size(); ++i)
    cout << v[i] << "\n";
}

如果我编译,我会得到错误 无法将{0, 1, 2, 3, 4, 5, 6}<brace-enclosed initializer list>转换为Vector<int>.我认为这可能与缺少对c++11或14的编译器支持有关,而我的compilerg++ 4.8.我是否必须在compiler设置中添加任何内容,还是另一个问题?谢谢

If I compile, I get the error could not convert {0, 1, 2, 3, 4, 5, 6} from <brace-enclosed initializer list> to Vector<int> . I thought this has maybe something to do with missing compiler support for c++11 or 14, my compiler is g++ 4.8. Do I have to add anything to the compiler settings or is it another problem? Thanks

推荐答案

确保您使用的是的新版本,而不是的版本.

Make sure you are using the new version of "std_lib_facilities.h" instead of the old one.

这篇关于如何在NetBeans 8.1中正确配置g ++编译器以获得c ++ 11/c ++ 14支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆