Re: /Zg question
- From: Bob Smith <bsmith@xxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 30 Jul 2007 15:53:30 GMT
On 7/30/2007 4:46 AM, Charles Wang[MSFT] wrote:
Hi Bob,
Maybe there is something typing error in your .bat file.
I performed a test in command prompt and it worked fine:
F:\Projects\ZgTestC\ZgTestC>cl /nologo /c /Zg /DPROTO /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd test.c >c:\zgtest.txt
The output was generated in c:\zgtest.txt
====================
extern int __cdecl Sum(int a,int b);
extern void __cdecl f2(struct MyStruct *t);
extern int __cdecl main();
====================
For your question, is the plan to remove support in the compiler for .C code in general?
By now, I have not got any notification of removing the support of this field. If you have any questions regarding VC compiler for .c code, you can still have a new post in community.
There's no typo in the .bat file. When I run it from the command line (say, Tools > Visual Studio 2005 Command Prompt), it works, for me as well. Unfortunately, and counterintuitively, that's not a substitute for running it under program control.
The problem is when I run it from a Custom Rule (with an Additional Dependency of ..\$(InputName).c so it runs at the appropriate time), in which case the exact same batch file displays the prototypes in the Output Window and the *.pro file is now empty (zero length).
My guess is that VCE runs cl with standard output diverted to a file which allows it to capture the output for display in its Output Window. The one case in which this is the wrong thing to do is with /Zg. If they want to remove support for /Zg for .cpp and .cxx files, fine. Just leave it in for .c files -- I find it very useful -- and perhaps change its behavior to specify the output file explicitly (as in /Fo).
Here's my Custom Build Rule -- I would appreciate it if you would attempt to duplicate this problem so I can either rule out or correct a mistake on my part:
<CustomBuildRule
Name="Prototype Normal"
DisplayName="Prototyping Normal"
CommandLine="protonrm ..\$(InputName).c [$ProtoFile]"
Outputs="[$ProtoFile]"
AdditionalDependencies="..\$(InputName).c"
FileExtensions="*.pro"
ExecutionDescription="Prototyping ..\$(InputName).c [$ProtoFile]"
>
<Properties>
<StringProperty
Name="ProtoFile"
DisplayName="ProtoFile"
Description="Prototype Output File"
Switch="[value]"
DefaultValue="$(IntDir)\$(InputName).pro"
/>
</Properties>
</CustomBuildRule>
with the compiler defines moved into the .bat file.
Use (say) a dummy foo.c file with one line:
int main (void) {}
and create by hand an empty foo.pro file so that file can be added to the project the first time, after which you can erase that file. Other than directory structure, that should be enough to duplicate this problem.
Many thanks in advance for your time. I'm just trying to prove or disprove my sanity.
--
_________________________________________
Bob Smith -- bsmith@xxxxxxxxxxxxxxxxxxxxx
To reply to me directly, delete "despam".
.
- Follow-Ups:
- Re: /Zg question
- From: Charles Wang[MSFT]
- Re: /Zg question
- From: Charles Wang[MSFT]
- Re: /Zg question
- References:
- /Zg question
- From: Schemer
- Re: /Zg question
- From: Charles Wang[MSFT]
- Re: /Zg question
- From: Bob Smith
- Re: /Zg question
- From: Charles Wang[MSFT]
- /Zg question
- Prev by Date: Re: /Zg question
- Next by Date: Re: /Zg question
- Previous by thread: Re: /Zg question
- Next by thread: Re: /Zg question
- Index(es):
Relevant Pages
|