问题描述
操作系统是Windows.
OS is windows.
首先,我会说我没有C ++或任何其他编译语言的经验.我曾经使用过CPython并对此很熟悉,但是直到今天早些时候,我什至从未浏览过C ++源代码.
I'll start off by saying that I have no experience with C++, or any other compiled language. I've used CPython a bit and am familiar with that, but, until earlier today, I'd never even glanced at C++ source.
我正在尝试自学C ++,所以我一直在玩弄它,而我遇到的一个问题是错误:
I'm trying to teach myself C++, so I've been playing around with it a bit, and one problem I'm having is the error:
error: 'to_string' was not declared in this scope
显然,to_string是C ++ 11的东西,应该就可以了.我下载了最新的MinGW,并将其添加到我的路径中-我已检查并运行
Apparently, to_string is a C++11 thing, which should be fine. I downloaded the latest MinGW, added it to my path - I have checked, and running
g++ - v
确实告诉我已经安装了4.8.1版.我正在使用的IDE的Code :: Blocks认为它没有问题,但是它根本不会使用任何C ++ 11东西,给了我类似上面的错误.并非C ++ 11独有的东西可以很好地编译.
does indeed tell me that I have version 4.8.1 installed. The IDE I'm working with, Code::Blocks finds it no problem, but it simply won't use any of the C++11 stuff, giving me errors such as the one above. Things not exclusive to C++11 compile fine.
我已经检查了编译器标志下的一部分,以遵循C ++ 11语言标准",但是即使如此,我仍然遇到相同的错误.我真的不确定发生了什么-我已经检查了一下,所有建议都是更新IDE或MinGW(两者都是最新的),或者选择该标志,正如我说,已经被选中.
There is a section under compiler flags to "follow the C++11 language standard", which I have checked, but, even then, I get the same errors. I'm really not sure what's going on - I've looked this up, and all of the suggestions are to update either the IDE or MinGW (both of which are up to date), or to select that flag, which, as I said, is already selected.
任何有C ++经验的人都知道会发生什么吗?b
Does anyone with more experience with C++ have any idea what might be going on?b
推荐答案
我的理解是,除regex
支持外,G ++的C ++ 11支持在4.8.1中已基本完成.
My understanding is that, other than regex
support, G++'s C++11 support is largely complete with 4.8.1.
以下两个链接突出显示了G ++ 4.8.1和libstdc ++中C ++ 11支持的状态:
The following two links highlight the status of C++11 support in G++ 4.8.1 and libstdc++:
- GCC 4.8.x中的C ++ 11状态.
- libstdc ++中的C ++ 11状态.请注意,适用于最新的SVN版本,与特定的G ++版本无关;因此期望它对G ++是乐观的".
- C++11 status in GCC 4.8.x.
- C++11 status in libstdc++. Note that this is for the latest SVN release, not tied to a specific G++ release; therefore expect it to be "optimistic" with respect to G++.
但是,要编译C ++ 11代码,则在编译时需要包括命令行标志-std=c++11
.
To compile C++11 code, though, you need to include the command line flag -std=c++11
when you compile.
这篇关于GCC 4.8.1 C ++ 11是否已完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!