在编译之前通过外部工具解析预处理源的任何方式? [英] Any way to parse preprocessed source through external tool before it compiles?

查看:146
本文介绍了在编译之前通过外部工具解析预处理源的任何方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要编译器运行预处理,生成所有的.i文件,就像它通常做的,如果我只是使用生成预处理文件选项,然后运行一个外部工具,等待它完成,然后继续与那些.i文件(当然可以修改)的编译。

I want the compiler to run preprocessing, generate all the .i files like it normally does if I just use the "generate preprocessed file" option, and then run an external tool, wait for it to complete, and then go on with the compilation of those .i files (which by now can be modified of course).

如果这是不可能的,是否有一种方法来运行外部工具在预处理和编译之前编译的每个文件? (可能是一个地狱调试在这样的环境,但仍然)。

If that is not possible, is there a way to run an external tool on every file that is being compiled before preprocessing and compilation? (Would probably be a hell to debug in environment like that, but still).

如果没有这样的选择,这甚至可以做到吗?我的意思是,编译器是否甚至使用那些.i文件,或者它们只是输出给用户某种方式?

If there is no option like that, could this even be done at all? I mean, does the compiler even use those .i files, or are they just output for the user somehow?

基本上,有任何方法自动篡改源在编译之前,但是没有修改实际的文件?

Basically, is there any way to automatically tamper with the source before it is compiled, but without modifying the actual files?

只是为了refs:我试图想一个聪明的方法来模糊所有的字符串,源。

Just for refs: I am trying to think of a smart way to obfuscate all the strings with minimum modification of the source.

推荐答案

让x.cpp成为你要预处理的文件。

Let x.cpp be your file you want to preprocess.


  1. 设置编译器选项为x.cpp生成预处理输出,让它为xi

  2. 将xi添加到项目中,并在属性中设置自定义构建工具。将输出文件设置为x.preprocessed.cpp。

  3. 将x.preprocessed.cpp添加到项目中。

有关详情,请参见 msdn

这篇关于在编译之前通过外部工具解析预处理源的任何方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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