[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
Mon Jul 7 11:36:22 PDT 2014


On 07/06/2014 05:42 PM, Larry Evans wrote:
> On 07/05/2014 03:43 PM, Larry Evans wrote:
>> 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:
> [snip]
>> /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.
>>
> [snip]
> This problem also reported here:
>
> http://stackoverflow.com/questions/17775390/clang-3-3-in-c1y-mode-cannot-parse-cstdio-header
>
>
> Will try solutions mentioned there if no one here has
> any better suggestions.
>
> -regards,
> Larry
After installing gcc4.9.0 and adding:

   -cxx-isystem /usr/local/include/c++/4.9.0

it compiles :(

/usr/bin/clang++ -std=c++1y -cxx-isystem /usr/local/include/c++/4.9.0 
hello_world.cpp -o hello_world.exe
./hello_world.exe
hello World





More information about the cfe-users mailing list