- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I'm playing around with some new features from c++11. One new thing is the 'to_string' method in <string>. I compile with icpc Version 14.0.0.051 Beta with the option '-std=c++11'.
[cpp]
#include <iostream>
#include <string>
int main(void)
{
int i = 345;
std::cout << "The number i = " << std::to_string(i) << std::endl;
return 0;
}
[/cpp]
However I get back the error at compile time:
main.cpp(9): error: namespace "std" has no member "to_string"
std::cout << "The number i = " << std::to_string(i) << std::endl;
I'm not very experienced with c++ so I'm probably doing something silly.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you fill out the beta survey, in particular where they ask for priorities on implementation of C++11 features?
Your example works with current Microsoft CL but not with ICL in the same environment.
This seems like a case for a problem report.
On linux, the situation seems more complicated:
I have to omit -std=c++11 to see the error you reported.
If I keep an old enough g++ active (one which doesn't accept -std=c++11) under icpc I get:
jb.cpp(6): error: more than one instance of overloaded function "std::to_string" matches the argument list:
function "std::to_string(long long)"
function "std::to_string(unsigned long long)"
function "std::to_string(long double)"
argument types are: (int)
std::cout << "The number i = " << std::to_string(i) << std::endl;
If I change path so as to make a current g++ active, your case runs fine with current released icpc Intel64 as well as on the most recent beta.
I don't expect icpc to fix problems which are caused by using a g++ which isn't recent enough to support your syntax, but you might ask whether icpc should warn you when you ask for -std=c++11 if your g++ is out of date.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh ok. My g++ version is apparently 4.3.4, which I don't think has the new standard.
I'm confused though. Does icpc link against the gcc libraries?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, icc is using the gcc header files and libraries.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page