Intel XENIX 286 Programmers Guide (86) - Tenox.tc
Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc
XENIX Programming cc: C Compiler You may use -D to define up to 20 macros on a command line. However, you cannot redefine a macro once it has been defined. If a file uses a macro, you must place the -D option before that file's name on the command line. For example, in the command cc main.c -DNEED a dd.c the macro "NEED" is defined for add.c but not defined for main.c. The -U option undefies a macro defined by a #define in each source file. The form -D name sets name to 0. The form -U name = string redefines name as the given string. Defining Include Directories You can explicitly define directories containing "include" files by using the -1 (for "include") option. This option adds the given directory to a list of directories to be searched for include files. The directories in the list are searched whenever an include directive is encountered in the source file. The option has the form -Idirectoryname where directoryname is a valid path name to a directory containing include files. For example, the command cc -1/usr/joe/include main.c causes the compiler to search the directory /usr/joe/include for include files requested by the source file main.c. The directories are searched in the order they are listed and only until the given include file is found. The /usr/include directory is the default include directory and is automatically searched after directories given with -1. Ignoring the Default Include Directories You can prevent the C preprocessor from searching the default include directory by using the -X option. This option is generally used with the -1 option to define the location of include files that have the same names as those found in the default directories, but which contain different definitions. For example, the command cc -X -1/usr/joe/include main.c add.c causes cc to look for all include files only in the directory /usr/joe/include. 2-13
cc: C Compiler XENIX Programming Saving a Preprocessed Source File You can save a copy of the preprocessed source file by using the -P and -E options. The file is identical to the original source file except that all C preprocesor directives and macros have been expanded or replaced. The -P option copies the result to the file named fiZename.i, where filename is the same name as the source file without the ".c" extension. The -E option copies the result to the standard output and places a add.i creates a preprocessed file from the source file add.c. The output is redirected to the file add.i. Note that -P and -E suppress compilation of the source file. Thus, no object file or program is created. Error Messages The C compiler generates a broad range of error and warning messages to help you locate errors and potential problems in programs. In addition to compiler messages, the cc command also displays error messages generated by the XENIX C preprocessor and the XENIX assembler and linker programs. The following sections describe the form and meaning of the compiler error messages and warning messages you can encounter while using the cc command. C Compiler Messages The C compiler displays messages about syntactic and semantic errors in a source file, such as misplaced punctuation, illegal use of operators, and undeclared variables. It also displays warning messages about statements containing potential problems caused by data conversions or the mismatch of types. Error and warning messages have the form filename ( linenumber ) : message where filename is the na me of the source file being compiled, linenumber is the number of the line in the source file containing the error, and message is a self-explanatory description of the error or warning. If an error is severe, the compiler displays a message and terminates the compilation. Otherwise, the compiler continues looking for other errors but does not create an object file. If only warning messages are displayed, the compiler completes compilation and creates an object file. 2-14
- Page 1 and 2: 0 • • •
- Page 3 and 4: The information in this document is
- Page 5 and 6: Table of Contents CONTENTS Compiler
- Page 7 and 8: Table of Contents CONTENTS Using Ot
- Page 9 and 10: Table of Contents CONTENTS Assemble
- Page 11 and 12: Table of Contents CONTENTS CHAPTER
- Page 13 and 14: Table of Contents TABLES TABLE TITL
- Page 15 and 16: Introduction XENIX Programming 10.
- Page 17 and 18: cc: C Compiler XENIX Programming Cr
- Page 19 and 20: cc: C Compiler XENIX Programming Th
- Page 21 and 22: cc: C Compiler XENIX Programming Th
- Page 23 and 24: cc: C Compiler XENIX Programming Cr
- Page 25 and 26: cc: C Compiler XENIX Programming Th
- Page 27: cc: C Compiler XENIX Programming Co
- Page 31 and 32: cc: C Compiler XENIX Programming Us
- Page 33 and 34: cc: C Compiler XENIX Programming Wh
- Page 35 and 36: cc: C Compiler XENIX Programming Co
- Page 37 and 38: cc: C Compiler XENIX Programming d
- Page 39 and 40: cc: C Compiler XENIX Programming Se
- Page 41 and 42: lint: C Program Checker XENIX Progr
- Page 43 and 44: lint: C Program Checker XENIX Progr
- Page 45 and 46: lint: C Program Checker XENIX Progr
- Page 47 and 48: lint: C Program Checker XENIX Progr
- Page 49 and 50: lint: C Program Checker XENIX Progr
- Page 51 and 52: lint: C Program Checker XENIX Progr
- Page 53 and 54: make: Program Maintainer XENIX Prog
- Page 55 and 56: make: Program Maintainer XENIX Prog
- Page 57 and 58: make: Program Maintainer XENIX Prog
- Page 59 and 60: make: Program Maintainer XENIX Prog
- Page 61 and 62: make: Program Maintainer XENIX Prog
- Page 63 and 64: make: Program Maintainer XENIX Prog
- Page 65 and 66: make: Program Maintainer print: $(F
- Page 67 and 68: SCCS: Source Code Control System XE
- Page 69 and 70: SCCS: Source Code Control System XE
- Page 71 and 72: SCCS: Source Code Control System XE
- Page 73 and 74: SCCS: Source Code Control System XE
- Page 75 and 76: SCCS: Source Code Control System XE
- Page 77 and 78: SCCS: Source Code Control System XE
<strong>XENIX</strong> Programming cc: C Compiler<br />
You may use -D to define up to 20 macros on a command line. However, you cannot<br />
redefine a macro once it has been defined. If a file uses a macro, you must place the -D<br />
option before that file's name on the command line. For example, in the command<br />
cc main.c -DNEED a dd.c<br />
the macro "NEED" is defined for add.c but not defined for main.c.<br />
The -U option undefies a macro defined by a #define in each source file. The form -D<br />
name sets name to 0. The form -U name = string redefines name as the given string.<br />
Defining Include Directories<br />
You can explicitly define directories containing "include" files by using the -1 (for<br />
"include") option. This option adds the given directory to a list of directories to be<br />
searched for include files. The directories in the list are searched whenever an include<br />
directive is encountered in the source file. The option has the form<br />
-Idirectoryname<br />
where directoryname is a valid path name to a directory containing include files. For<br />
example, the command<br />
cc -1/usr/joe/include main.c<br />
causes the compiler to search the directory /usr/joe/include for include files requested<br />
by the source file main.c.<br />
The directories are searched in the order they are listed and only until the given include<br />
file is found. The /usr/include directory is the default include directory and is<br />
automatically searched after directories given with -1.<br />
Ignoring the Default Include Directories<br />
You can prevent the C preprocessor from searching the default include directory by<br />
using the -X option. This option is generally used with the -1 option to define the<br />
location of include files that have the same names as those found in the default<br />
directories, but which contain different definitions. For example, the command<br />
cc -X -1/usr/joe/include main.c add.c<br />
causes cc to look for all include files only in the directory /usr/joe/include.<br />
2-13