VC编译器

VC编译器由cl,link,mc及rc组成。

cl主要用来把源文件编译成目标文件--obj。

link主要把obj文件链接成可执行文件如exe和dll。

mc --是message compiler消息编译器。

rc--是resource compiler资源编译器。

 

介绍cl和link的文章很多,但是介绍mc和rc的很少,因此这里不再累述cl和link,主要讨论mc和rc命令。

mc--消息编译器

 

Microsoft (R) Message Compiler  Version 1.12.2505
Copyright (c) Microsoft Corporation. All rights reserved.

usage: MC [-?aAcdnosuUvw] [-m maxmsglen] [-h dirspec] [-e extension] [-r dirspec] [-x dbgFileSpec] filename.mc
       -? - displays this message
       -a - input file is ANSI (default).
       -A - messages in .BIN file should be ANSI.
       -b - .BIN filename should have .mc filename_ included for uniqueness.
       -c - sets the Customer bit in all the message Ids.
       -d - FACILTY and SEVERITY values in header file in decimal.
            Sets message values in header to decimal initially.
       -e extension - Specify the extension for the header file.
                      From 1 - 3 chars.
       -h pathspec - gives the path of where to create the C include file
                     Default is .\
       -m maxmsglen - generate a warning if the size of any message exceeds
                      maxmsglen characters.
       -n - terminates all strings with null's in the message tables.
       -o - generate OLE2 header file (use HRESULT definition instead of
            status code definition)
       -r pathspec - gives the path of where to create the RC include file
                     and the binary message resource files it includes.
                     Default is .\
       -s - insert symbolic name as first line of each message.
       -u - input file is Unicode.
       -U - messages in .BIN file should be Unicode (default).
       -v - gives verbose output.
       -w - warns if message text contains non-OS/2 compatible inserts.
       -x pathspec - gives the path of where to create the .dbg C include
                        file that maps message Ids to their symbolic name.
       filename.mc - gives the names of a message text file
                     to compile.
       Generated files have the Archive bit cleared.
 

 

 编译一个消息文件可以用mc -v xxx.mc其中xxx.mc文件格式如下

 

MessageIdTypedef=DWORD

SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS
               Informational=0x1:STATUS_SEVERITY_INFORMATIONAL
               Warning=0x2:STATUS_SEVERITY_WARNING
               Error=0x3:STATUS_SEVERITY_ERROR
              )

FacilityNames=(System=0x0:FACILITY_SYSTEM
               Runtime=0x2:FACILITY_RUNTIME
               Stubs=0x3:FACILITY_STUBS
               Io=0x4:FACILITY_IO_ERROR_CODE
              )

LanguageNames=(English=0x409:MSG00409)

MessageId=0x1
Severity=Error
Facility=Runtime
SymbolicName=MSG_BAD_ERROR1
Language=English
error one.//will appear in the event description.
.

MessageId=0x2
Severity=Warning
Facility=Io
SymbolicName=MSG_BAD_ERROR2
Language=English
error two.//will appear in the event description.
.

MessageId=0x3
Severity=Success
Facility=System
SymbolicName=MSG_BAD_ERROR3
Language=English
error three.//will appear in the event description.
.

rc --资源编译器

 


Microsoft (R) Windows (R) Resource Compiler Version 5.2.3690.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Usage:  rc [options] .RC input file
Switches:
   /r    Emit .RES file (optional)
   /v    Verbose (print progress messages)
   /d    Define a symbol
   /u    Undefine a symbol
   /fo   Rename .RES file
   /l    Default language ID in hex
   /i    Add a path for INCLUDE searches
   /x    Ignore INCLUDE environment variable
   /c    Define a code page used by NLS conversion
   /w    Warn on Invalid codepage in .rc (default is an error)
   /y    Don't warn if there are duplicate control ID's
   /n    Append null's to all strings in the string tables.
Flags may be either upper or lower case
 

 

 

 

 

 

posted on 2011-08-07 16:06  呼风唤雨  阅读(693)  评论(0编辑  收藏  举报

导航