[cfe-users] -std=c++1y apparently uses gcc4.8 includes and gives many errors with a hello_world.cpp

Larry Evans cppljevans at suddenlink.net
Sat Jul 5 13:43:55 PDT 2014


When compiled with:
   -std=c++11
the simple hello_world.cpp:

#include <iostream>
int main()
{
   std::cout<<"hello World\n";
   return 0;
}

runs OK; however, with:
   -std=c++1y
it gives error:

clang++ -std=c++1y hello_world.cpp -o hello_world.exe
In file included from hello_world.cpp:1:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/iostream:39:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ostream:38:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ios:42:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/ios_base.h:41:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/locale_classes.h:40:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/string:52:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/basic_string.h:2815:
In file included from 
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/string_conversions.h:43:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11: 
error: no member named 'gets' in the global namespace
   using ::gets;
         ~~^
1 error generated.

How do I get right iostream for -std=c++1y.
I used default configure (except I specified--enable-optimized).
I'm running on ubuntu 14.04:
evansl at lje-OptiPlex-9020:~/dwnlds/llvm/git/build/release/object$ uname -a
Linux lje-OptiPlex-9020 3.13.0-30-generic #54-Ubuntu SMP Mon Jun 9 
22:45:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

and followed instruction on:

http://llvm.org/docs/GettingStarted.html#git-mirror

What should I do to get hello_world to compile & run?

-regards,
Larry




More information about the cfe-users mailing list