PDA

View Full Version : how to write clang++ compliant c++ code.


fedvasu
1st November 2011, 10:08 AM
is clang++ mad?

here is the simple hello world-ish program in c++ , g++ compiles it like a charm and works well
i've learnt all my c++ , using g++


#include<iostream>
using namespace std;

int main()
{
cout<<"what the hell"<<endl;
return 0;
}


when compiling with clang++ , i get this error

crap.cpp:1:9: fatal error: 'iostream' file not found
#include<iostream>

is there a way to write c++ programs (other than writing c) which can be compiled by both clang++ and g++.

I know this is the most common problem faced by all of those who used clang++ , but quick google search yielded nothing absolutely nothing.

i also remember compiling this using clang++ 2.6 or so , it worked well , i'm using fedora 16 default version.

or am being totally ugly and idiotic?

please forgive my rants.

leigh123linux
1st November 2011, 10:12 AM
http://forums.fedoraforum.org/showthread.php?t=271272&highlight=clang