How to output preprocessed code AND compile it (Visual Studio)

前端 未结 3 1349
小鲜肉
小鲜肉 2021-02-15 17:27

I\'m generating preprocessor output (.i) from Visual Studio, but also want to do the actual build. Is there a combination of flags that will both output the .i file without then

相关标签:
3条回答
  • 2021-02-15 17:35

    Use the switch /P Example- cl /C sample.c

    The above will generate a .I file with same name (sample.I). Now to compile the .I file, just rename .I file to .C then do cl /c to compile and generate an object file.

    0 讨论(0)
  • 2021-02-15 17:38

    You can create a custom build config that does pre-processing and then define a batch build that builds the pre-processed version followed by the actual compiled / linked version.

    0 讨论(0)
  • 2021-02-15 17:40

    You can add a custom build step or a new target to dump the preprocess after the code is built by definition the dumped preprocessor output is what is built.

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