C, Objective-C preprocessor output

前端 未结 4 1681
野的像风
野的像风 2021-01-11 12:22

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.

相关标签:
4条回答
  • 2021-01-11 12:34

    From within Xcode:

    • Xcode 3: Select the file, then Build → Preprocess.
    • Xcode 4: Select the file, then Product → Generate Output → Generate Preprocessed File.
    0 讨论(0)
  • 2021-01-11 12:38

    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.

    0 讨论(0)
  • 2021-01-11 12:45

    In Xcode 5: Select the .m file, then Product -> Perform Action -> Preprocess ".m"

    0 讨论(0)
  • 2021-01-11 12:54

    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.

    0 讨论(0)
提交回复
热议问题