Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 stopping the compiler from going ahead with the build as normal?

This is currently just C++ but will probably want to use this with CUDA later, so prefer answers that work within Visual Studio rather than require command line (unless it works for CUDA too).

The point of this is to save the time it takes to do Project->Properties->Config Props->C/C++->Preprocessor->Generate Preprocessed File Yes/No plus Rebuild. Particularly it is irksome to me that the preprocessor has to run twice, so a solution that somehow generates the .i file in part 1 and then compiles that file in part 2 would be fine.

The exact version of Visual Studio I'm using is VS 2008 Express

like image 303
Raffles Avatar asked Oct 19 '11 18:10

Raffles


1 Answers

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.

like image 146
rerun Avatar answered Oct 06 '22 00:10

rerun