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.
When the C preprocessor is used with the C, C++, or Objective-C compilers, it is integrated into the compiler and communicates a stream of binary tokens directly to the compiler's parser. However, it can also be used in the more conventional standalone mode, where it produces textual output.
The Objective-C Preprocessor is not part of the compiler, but is a separate step in the compilation process. In simplistic terms, an Objective-C Preprocessor is just a text substitution tool and it instructs compiler to do required pre-processing before actual compilation.
On the command line, gcc -E foo. m will show you the preprocessed output (just as it does for normal C/C++ files).
Macros can be used in many languages, it's not a specialty of objective-c language. Macros are preprocessor definitions. What this means is that before your code is compiled, the preprocessor scans your code and, amongst other things, substitutes the definition of your macro wherever it sees the name of your macro.
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.
From within Xcode:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With