1.目标机器至少要有什么条件,才能使用 cl 命令 ? (是否至少应该安装了一个 C++ 编译器)。2.该命令的使用方法?(假设我的程序有 My.cpp, My.h, resource.h , 一些图标,一个由 VC++ 生成的 make 文件)3.如果目标机器有 C++Buider ,如果编译。4.如果我的程序中用到了 MFC ,是否还能移植 ?
(主要第 1,2 题就行了。3,4 题如果有人答了,另外再加分)

解决方案 »

  1.   

    1.有cl应该就OK了,cl就是编译器,和unix下的gcc是一样的道理2. cl   a1.cpp a2.cpp a3.cpp aa.lib bb.liba1.cpp a2.cpp a3.cpp对应于工程中的所有cpp文件
    aa.lib bb.lib对应于使用的lib不过上面的语法是对应于不使用资源的,如果使用资源的,好象先要用
    rc example1.rc对资源进行编译。
    然后如何将编译好的资源,再和工程的其他目标文件一起连接,我也不太清楚了。如果你有make文件,那就一切好办了
    nmake example1.mak就一切OK3.4。
    如果你是用SDK写的。CBuilder应该可以编译,如果用了MFC,那你得include MFC的头文件,添加lib类库mfc42.lib,理论上应该是可以编译的。
      

  2.   

    Option Action 
    /ALIGN:number Specifies the alignment of each section 
    /BASE:{address | @filename,key} Sets a base address for the program 
    /COMMENT:["]comment["] Inserts a comment string into header 
    /DEBUG Creates debugging information 
    /DEBUGTYPE:CV
    /DEBUGTYPE:COFF
    /DEBUGTYPE:BOTH Creates particular formats of debugging information 
    /DEF:filename Passes a module-definition (.DEF) file to the linker 
    /DEFAULTLIB:library Searches specified library when resolving external references 
    /DELAY Controls the delayed loading of DLLs 
    /DELAYLOAD Causes the delayed loading of the specified DLL 
    /DLL Builds a DLL 
    /DRIVER[:UPONLY] Creates a Windows NT kernel mode driver 
    /ENTRY:function Sets the starting address 
    /EXETYPE:DYNAMIC Builds a virtual device driver 
    /EXPORT Exports a function 
    /FIXED[:NO] Creates a program that can be loaded only at its preferred base address 
    /FORCE[:{MULTIPLE|UNRESOLVED}] Forces link to complete in spite of unresolved or multiply defined symbols 
    /GPSIZE:# Specifies the size of communal variables for MIPS and Alpha platforms 
    /HEAP:reserve[,commit] Sets the size of the heap in bytes 
    /IMPLIB:filename Overrides the default import library name 
    /INCLUDE:symbol Forces symbol references 
    /INCREMENTAL:{YES|NO} Controls incremental linking 
    /LARGEADDRESSAWARE Tells the compiler that the application supports addresses larger than two gigabytes. 
    /LIBPATH:path Allows the user to override the environmental library path 
    /LINK50COMPAT Generates import libraries in Visual C++ Version 5.0 format 
    /MACHINE:{IX86|ALPHA|ARM|MIPS|MIPSR41XX|PPC|SH3|SH4} Specifies the target platform 
    /MAP Creates a map file  
    /MAPINFO:{EXPORTS|FIXUPS|LINES} Includes the specified information in the map file 
    /MERGE:from=to Combines sections 
    /NODEFAULTLIB[:library] Ignores all (or specified) default libraries when resolving external references 
    /NOENTRY Creates a resource-only DLL 
    /NOLOGO Suppresses startup banner 
    /OPT:{REF|NOREF|ICF[,iterations]|NOICF} Controls LINK optimizations 
    /ORDER:@filename Places COMDATs into the image in a predetermined order 
    /OUT:filename Specifies the output file name 
    /PDB:filename Creates a program database (.PDB) file 
    /PDBTYPE:{con[solidate]|sept[ypes]} Specifies where to store the Program Database (PDB) debug type information. 
    /PROFILE Enables profiling (creates a mapfile) 
    /RELEASE Sets the checksum in the .EXE header 
    /SECTION:name,attributes Overrides the attributes of a section 
    /STACK:reserve[,commit] Sets the size of the stack in bytes 
    /STUB:filename Attaches an MS-DOS stub program to a Win32 program 
    /SUBSYSTEM:{CONSOLE|WINDOWS|NATIVE|POSIX|WINDOWSCE} [,major[.minor] ] Tells the operating system how to run the .EXE file 
    /SWAPRUN:{NET|CD} Tells the operating system to copy the linker output to a swap file before running it 
    /VERBOSE[:LIB] Prints linker progress messages 
    /VERSION:major[.minor] Assigns a version number 
    /VXD Creates a virtual device driver (VxD) 
    /WARN[:level] Specifies warning level 
    /WS:AGGRESSIVE Aggressively trim process memory