views:

133

answers:

3

Is there a way to get pre-processed C/Objective-C code? I have some files I acquired and would like to see the code produced by some #defines.

+2  A: 

Use the -E command-line argument to gcc or clang. This is documented as: “Preprocess only; do not compile, assemble or link” and indeed it outputs the preprocessed version to stdout.

Nate
+2  A: 

On the command line, gcc -E foo.m will show you the preprocessed output (just as it does for normal C/C++ files). Of course, this will also expand any #include or #import statements you may have in your code.

Mark Rushakoff
+5  A: 

From within Xcode: select file then Build => Preprocess.

Paul R