Skip to main content

Xcode 3.1: Setting the Compiler Version

·2 mins

Xcode 3.1 adds the Compiler Version build settings collection, which provides a GUI to set the compiler version for C, C++, and Objective C programs. Prior to the release of Xcode 3.1, there wasn’t a big need to set the compiler version. GCC 4.0, Xcode’s default compiler for Xcode 2 and 3, was the right choice for most people. You had to use GCC 4 to compile for Intel Macs. Unless you were writing an appliction in C++ and wanted to support versions of Mac OS X older than 10.3.9, there wasn’t much of a reason not to use GCC 4.0.

But with the release of Xcode 3.1 comes two new compiler choices: GCC 4.2 and LLVM (Low Level Virtual Machine)-GCC 4.2. Programs compiled with GCC 4.2 and LLVM-GCC 4.2 will not run on anything older than Mac OS X 10.5. If you want to support Mac OS X 10.4, you’ll still have to use GCC 4.0.

Of the two new compiler choices, LLVM-GCC 4.2 is the more intriguing choice. LLVM-GCC 4.2 uses GCC as the front end parser, which does the syntax checking. It uses LLVM for the back end to do optimization and create object code. Code compiled with LLVM-GCC should run faster than code compiled with GCC. Apple is providing a lot of support for the LLVM project so don’t be surprised if LLVM becomes a big part of Mac development in the future. You can learn more about LLVM-GCC by reading the release notes.