CL Command Line Options Must Precede Source File NameLast reviewed: July 17, 1997Article ID: Q92499 |
6.00 6.00a 6.00ax 7.00 | 6.00 6.00a | 1.00 1.50
MS-DOS | OS/2 | WINDOWSkbtool The information in this article applies to:
SUMMARYThe syntax of the Microsoft C/C++ compiler CL command is as follows:
cl [option] file ... [option | file]... [lib] [/link link-opt]If an option specification is placed on the command line incorrectly, no error message may be generated or an incorrect error message may be generated. This usually occurs if an option is placed after the file name. In some cases, an incorrect object file or executable file may be generated.
MORE INFORMATIONTwo examples are listed below. There are many combinations of commands that may produce other symptoms.
Example 1: Debugging Information Option Switch (/Zi) Specified IncorrectlyIf the command to compile a "hello world" program is given as follows:
cl hello.c /Zithe program compiles without error. However, if the program is debugged with the CodeView debugger, no source code is available. However, CodeView does not give a CV0101 warning message to indicate that no CodeView information is available because the CL command processor passes the /CO (CodeView) option to the linker. The resulting executable file contains some CodeView information. The correct command to build an application and include CodeView information is as follows:
cl /Zi hello.cIf an application is built without the /Zi switch, CodeView issues the following warning message when it loads the application:
CV0101 Warning: no CodeView information for 'hello.exe' Example 2: Memory Model Specified IncorrectlyIf a "hello world" program is built in large memory model as follows:
cl hello.c /ALthe compiler performs some work and then issues the following message:
Command line error D2002 : conflict in memory-model specificationThe D2002 error occurs because the compiler compiles HELLO.C for the small memory model (the default) and then attempts to compile a second source module with the large memory model. A HELLO.OBJ file is generated and its code is in the small memory model. The linker is not called because D2002 is a fatal error.
|
Additional reference words: kbinf 7.00 8.00 8.00c 1.00 1.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |