Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Itanium-based Systems: HP aC++/HP C Programmer's Guide > Chapter 2 Command-Line Options

Preprocessor Options

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

The following options are accepted by the preprocessor:

-C

-C

Using the -C option prevents the preprocessor from stripping comments. This option is supported in aCC only if -tp is used. See the description of cpp in the cpp(1) manpage for details.

-Dname

-Dname[=def]

name is the symbol name that is defined for the preprocessor.

def is the definition of the symbol name (name).

The -Dname option defines a symbol name (name) to the preprocessor, as if defined by the preprocessing directive #define.

If no definition (def) is given, the name is defined as 1.

NOTE: __ia64 and __HP_aCC are defined automatically.

Example:

The following example defines the preprocessor symbol DEBUGFLAG and gives it the value 1.

aCC -DDEBUGFLAG file.C

The following program uses this symbol:

#include <iostream.h>
void main(){
   int i, j;
   #ifdef DEBUGFLAG
   int call_count=0;
   #endif
   /* ... */
}

-E

-E

Using the -E option runs only the preprocessor on the named C++ files and sends the result to standard output (stdout).

An exception to this rule is when -E is used with either the +m[d] or +M[d] option, the only output is the make dependency information. Unlike the -P option, the output of -E contains #line entries indicating the original file and line numbers.

Redirecting Output From This Option

Use the -.suffix option to redirect the output of this option.

+m[d] and +make[d]

+m[d]

The +m[d] option directs a list of the quote enclosed (" ") header files upon which your source code depends to stdout. The list is in a format accepted by the make command.

If +md is specified, the list is directed to a .d file. The .d file name prefix is the same as that of the object file. The .d file is created in the same directory as the object file.

Usage:

Use +m[d] when you also specify the -E or the -P option. When used with the -E option, only dependency information is generated.

Table 2-5 “Examples” lists examples of the +m[d] option.

Table 2-5 Examples

Command Line Specified

.d file name

.d file location

Preprocessing Output

aCC -c +m a.C

none

stdout

none

aCC -c -E -.i +md a.C

a.d

current directory

none

aCC -c -P +md a.C -o b.o

b.d

current directory

a.i

aCC -c -P +md a.C -o /tmp/c

c.d

/tmp directory

a.i

 

+M[d] and +Make[d]

+M[d]

The +M[d] option directs a list of both the quote enclosed (" ") and angle bracket enclosed (< >) header files upon which your source code depends to stdout. The list is in a format accepted by the make command.

If +Md is specified, the list is directed to a .d file. The .d file name prefix is the same as that of the object file. The .d file is created in the same directory as the object file.

Usage:

Use +Md when you also specify the -E or the -P option. When used with the -E option, only dependency information is generated.

Table 2-6 Examples

Command Line Specified

.d file name

.d file location

Preprocessing Output

aCC -c +M a.C

none

stdout

none

aCC -c -E -.i +Md a.C

a.d

current directory

none

aCC -c -P +Md a.C -o b.o

b.d

current directory

a.i

aCC -c -P +Md a.C -o /tmp/c

c.d

/tmp directory

a.i

 

-P

-P

Using the -P option only preprocesses the files named on the command line without invoking further phases. It leaves the result in corresponding files with the suffix .i.

For example, the following command preprocesses the file prog.C leaving the output in the file prog.i. It does not compile the program.

aCC -P prog.C

-Uname

-Uname

name is the symbol name whose definition is removed from the preprocessor.

This option undefines any name that has initially been defined by the preprocessing stage of compilation.

A name can be a definition set by the compiler. This is displayed when you specify the -v option. A name can also be a definition that you have specified with the -D option on the command line.

The -D option has lower precedence than the -U option. If the same name is used in both, the -U option and the -D option, the name is undefined regardless of the order of the options on the command line.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.