你們都說clang好,於是我就十分想試一試。我手上的機器只有fedora 17、CentOS 4/5/6。CentOS的repositories裡面沒有clang。但是fedora 17裡面有,於是我就興致勃勃的裝了一個。結果發現,連最簡單的Hello World都編譯不過去。 [changming@test 1]$ clang++ hello.cpp In file included from hello.cpp:1: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:39: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:39: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ios:42: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:40: /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/atomicity.h:48:45: error: use of undeclared identifier ‘__ATOMIC_ACQ_REL’ { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } ^ /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/atomicity.h:52:38: error: use of undeclared identifier ‘__ATOMIC_ACQ_REL’ { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } ^ 2 errors generated. [changming@test14 1]$ clang hello.cpp In file included from hello.cpp:1: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:39: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:39: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ios:42: In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:40: /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/atomicity.h:48:45: error: use of undeclared identifier ‘__ATOMIC_ACQ_REL’ { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } ^ /usr/bin/../lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/atomicity.h:52:38: error: use of undeclared identifier ‘__ATOMIC_ACQ_REL’ { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }