如何输出预处理代码并编译它(Visual Studio) [英] How to output preprocessed code AND compile it (Visual Studio)

查看:713
本文介绍了如何输出预处理代码并编译它(Visual Studio)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Visual Studio中生成预处理器输出(.i),但也想做实际构建。有没有标志的组合,将输出.i文件,然后停止编译器继续正常的生成?

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?

这是目前只是C ++,但会可能想要在CUDA以后使用这个,所以更喜欢在Visual Studio中工作的答案,而不是需要命令行(除非它也适用于CUDA)。

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).

是保存执行Project-> Properties-> Config Props-> C / C ++ - > Preprocessor-> Generate Preprocessed File Yes / No + Rebuild所需的时间。特别是对我来说,预处理器必须运行两次,所以一个解决方案,以某种方式生成.i文件在第1部分,然后编译该文件在第2部分将是很好的。

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.

我使用的Visual Studio的确切版本是VS 2008 Express

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

推荐答案

您可以添加自定义构建步骤或者一个新的目标,通过定义构建代码之后转储预处理。转储的预处理器输出是构建的。

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.

这篇关于如何输出预处理代码并编译它(Visual Studio)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆