This topic describes how to build the target using the Xcode IDE and also documents the build steps using the xcodebuild utility.
To build the active target and configuration in Xcode, choose Build from the Build menu or click the Build button in the toolbar. To view the results of your build, choose Build Results from the Build menu in the Xcode toolbar. You can view additional build details by clicking the build transcript icon in the Build Results window.
To build an individual file and not the entire project, select the file under the target and then choose Compile from the Action drop-down menu in the toolbar.
Note
Choosing Build from the Build menu or clicking the Build button in the toolbar builds the target specified in the Active Target drop-down menu in the toolbar and not the target or source file currently selected in the Groups & Files list.
You can change the compilation order of the Xcode target. To re-order the files listed under a target's Compile Sources, click a source and drag it before or after other compilations.
You can also use the xcodebuild utility to build a target. This utility uses the Xcode project file settings to build target projects from the command line. If you have previously configured your Xcode project to build with the Intel compiler, xcodebuild will invoke that compiler from the command line. The basic steps are as follows:
Check that the Xcode project is configured to use the Intel C++ compiler.
Launch a terminal window by selecting Finder > Applications > Utilities > Terminal.
Change directories to the project directory containing the Xcode project file.
Issue an xcodebuild command
similar to the following:
xcodebuild -project test2.xcodeproj -target testapp
-configuration Debug
To run the program, type the following:
./build/Debug/testapp
To build a 64-bit executable from within Xcode, edit the executable's target and replace "and" with "to" change the Architectures setting to x86_64 (you may need to manually enter this selection). This produces a 64-bit binary for Intel® 64 architecture.
Note
The Intel C++ Compiler generates code solely for Intel architectures.
The 64-bit data model used by Mac OS is known as LP64. The use of the LP64 data model ensures that source code created on other platforms can be easily ported to the Mac OS platform.
The LP64 data model defines these C/C++ types as follows:
ints are 32 bit
longs, long-longs, and pointers are 64 bit
The following C/C++ restrictions and guidelines apply:
ints can no longer hold pointers since pointers are 64-bit types in the LP64 data model.
A possible point of confusion is that an unsigned 64-bit number can look like a signed 32-bit value.
Casting variables can destroy data; do not cast between a 64-bit and 32-bit types.
Use the correct printf directives for printing types.
Use the __LP64__ macro to conditionally compile 64-bit code or define 64-bit APIs.