如何获取任何C / C ++编译器的中间文件(即I.files)? [英] How to obtain the intermediate files (i.e. I.files) for any C/C++ compilers?

查看:58
本文介绍了如何获取任何C / C ++编译器的中间文件(即I.files)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行代码缺陷测试。例程如下:我从客户端接收要测试的源代码,然后使用预处理/处理源代码生成中间文件(即.i文件)我的机器中的编译器而不是客户端使用的编译器。出现问题的原因是我获得的中间文件没有资格进一步分析。例如,我的机器上安装的编译器无法识别某些特定的宏。我猜测编译器的配置依赖于开发环境,如你所知,许多代码都是在IDE中编程的。因此,当我尝试将原始源代码移植到我的机器上时,某些编译器配置丢失或错误。总而言之,我想要实现的是获取在客户端开发环境下生成的中间文件。要求解决方案尽可能简单,因为我不想给客户带来太多负担。任何帮助将不胜感激。



我尝试过:



我还没有想出任何解决方案。

I am working on code defect testing.The routine goes as follows: I receive source codes to be tested from the client, and then pre-process/treatment source codes to produce the intermediate files(that is .i files) using the compiler in my machine instead of the compiler the client uses. The problem arises because the intermediate files I obtain is not eligible to be analyzed further. For example, some particular macros cannot be recognized by the compiler installed on my machine. I surmise that the configuration of compiler is dependent on the development environment, as you know, many codes are programmed in an IDE. As a consequence, when I attempt to transplant the original source code onto my machine, some configurations of compiler are missing or wrong. All that said, what I want to achieve is to obtain the intermediate files generated under the client's development environment. It's required that the solution should be simple as possible because I don't want to put too much burden on clients. Any help would be appreciated.

What I have tried:

I have not figured out any solution yet.

推荐答案

引用:

我猜测编译器的配置依赖于开发环境,如你所知,许多代码都是在IDE中编程的。

I surmise that the configuration of compiler is dependent on the development environment, as you know, many codes are programmed in an IDE.



编号IDE非常独立:相同的IDE(Visual例如Studio)可以用于许多不同的语言,包括C,C ++,C#,VB,F#,......



IDE不进行编译:它使用许多编译器中的一个来做到这一点,甚至不需要 - 你可以用文本编辑器编写代码,或者如果你真的很努力就用Microsoft Excel电子表格编写代码:有些人习惯性地使用基本的文本编辑器偏好IDE。



如果你需要中间文件 - 我不知道他们为什么会有所帮助,因为它们将特定于编译器而不是一般可读,如果编译器甚至生成它们 - 然后您将需要使用客户端正在使用的确切编译器(甚至是编译器的版本)来生成它们。你不能假设一个版本的编译器的代码可以在不同的版本中工作,更不用说它会在一个完全不同的编译器中正确编译!


No. The IDE is pretty much independent: the same IDE (Visual Studio for example) can be used for many different languages, including C, C++ , C#, VB, F#, ...

The IDE does not do the compilation: it uses one of many compilers to do that, and isn't even needed - you can write code with a text editor, or even in a Microsoft Excel spreadsheet if you try really hard: and some people do habitually use a basic text editor in preference to an IDE.

If you need "intermediate files" - and I have no idea why they would help since they will be specific to a compiler rather than generally readable if the compiler even generates them - then you will need to use the exact compiler (and even version of the compiler) that your client is using in order to generate them. You cannot assume that code for one version of a compiler will work in a different version, much less that it will compile correctly in a totally different compiler!


告诉客户端给你发送完整的项目,而不仅仅是源文件。
Tell the client to send you the complete project, not just the source files.


引用:

当我尝试移植原始源代码时在我的机器上,一些编译器配置丢失或错误。总而言之,我想要实现的是获取在客户端开发环境下生成的中间文件。

when I attempt to transplant the original source code onto my machine, some configurations of compiler are missing or wrong. All that said, what I want to achieve is to obtain the intermediate files generated under the client's development environment.



您可以为客户端提供一个后期构建步骤以收集所需的文件在他/她的机器上。


You could provide the client a post build step in order to collect the required files on his/her machine.


这篇关于如何获取任何C / C ++编译器的中间文件(即I.files)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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