Paul Solt
clang++ is awesome, goodbye g++
I finally got around to reading up on the clang compiler and I love it. The error messages are so helpful. Here’s a quick example with a syntax error. Lets compile it on the command line.
#include <iostream>
int main() {
std::cotut << "Hello World";
return 0;
}
What happens when I run the code with g++?
paulsolt@~/dev $ g++ test.cpp test.cpp: In function ‘int main()’: test.cpp:3: error: ‘cotut’ is not a member of ‘std’
Here’s what happens in clang++, notice how it highlights the position and it’s actually more helpful in fixing the error.
paulsolt@~/dev $ clang++ test.cpp
test.cpp:4:7: error: no member named 'cotut' in namespace 'std'; did you mean 'cout'?
std::cotut << "Hello World";
~~~~~^~~~~
cout
/usr/include/c++/4.2.1/iostream:63:18: note: 'cout' declared here
extern ostream cout; ///< Linked to standard output
2 Responses to clang++ is awesome, goodbye g++
Leave a Reply Cancel reply
Artwork Evolution
Facebook
@PaulSolt
- RT @flexibits: Happy 1st Birthday, Fantastical! http://t.co/bIcVDgbZ 2012/05/18
- @IAmReynolds thanks, I think it's the color choice that made it look good. Gradient colors similar to the line color. 2012/05/17
- @rwenderlich I'm interested if this is still an option. I did a text-based risk game back in high school. It could work for an iPad app. 2012/05/16
Github
Tags
animation App Store Artwork Evolution Boost Boot Camp C++ cross platform development Dual Monitors function pointers Gears of War 2 gestures git GLUT inheritance iOS iPad iPhone Macbook Pro Mac OS X MacPorts member functions Objective-C OCUnit OpenGL player/stage polymorphism presentation programming remote control RIT SCM slides static methods STL svn 1.6 tdd testable code testing unit testing version control Windows XP Xbox 360 Xcode xcode 3.1.2







Looks good! How do we install clang++?
It’s in the upcoming editor from Apple. See the open source site: http://clang.llvm.org/