本文介绍了从Microsoft使用CL.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一种工具,可以在内部使用Microsoft CL.exe编译器在Iam上编写C代码来编译我的源文件.使用我的工具创建标头和.C源文件.例如,我已经使用工具创建了EXTRA.h和EXTRA.C,并且在编译过程中,我将.C文件通过一些编译器选项传递给了编译器,例如:: cl.exe/c/nologo/G3/Zl/W3/Ox/Oy-/Zp8/D_32bit/DTARGET32 EXTRA.c,其中CL.exe编译我的.c文件并可以正常工作,如果有的话,编译器也会引发错误,

但是,如果.h文件中存在某些错误,就像我错过了标头文件中的一些半冒号或不需要的关键字一样. CL.exe编译器始终仅对.c文件抛出错误.示例:EXTRA.h
dfdfdfdfgdfg
EXTRA.C
没错

在这种情况下,编译器将引发错误,如下所示:

EXTRA.c(21):错误C2054:预期``(''后跟``dfdfdfdfgdfg''

尽管Heaer文件(.h文件)中存在错误,但编译器表示引用.c文件时出现错误,请参见上述编译器消息.


I have developed a tool to write C code where Iam internally using Microsoft CL.exe compiler for compilation of my source file. Using my Tool I create header and .C source file. For example I have created EXTRA.h amd EXTRA.C using the Tool and for the compilation process I pass my .C file to the compiler with some compiler option as :: cl.exe /c /nologo /G3 /Zl /W3 /Ox /Oy- /Zp8 /D_32bit /DTARGET32 EXTRA.c where CL.exe compiles my .c file and works fine also compiler throws error if there is any,

But if there is some error in the .h file as If I missed some semi colon or undesired Keyword in the Header file. CL.exe Compiler always throws error with respect .c file only. Example : EXTRA.h
dfdfdfdfgdfg
EXTRA.C
No error.

In this case Compiler throws error as:

EXTRA.c(21) : error C2054: expected ''('' to follow ''dfdfdfdfgdfg''

Although error is there in the Heaer file (.h file ) but compiler says error refering to the .c file please see above mentioned compiler message.


Compiler doesn''t refer to error in .h file.

推荐答案


这篇关于从Microsoft使用CL.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 19:22