---
name: "occ"
section: "1"
platform: "linux"
package: "openc++"
version: "2.8-4"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/occ"
---

# occ(1)

OpenC++ compiler

## NAME

occ - OpenC++ compiler

## SYNOPSIS

**occ** \[ **-g** \] \[ **-M** *option***=***value* \] \[ **-l** \] \[ **-S** *metaclass* \] \[ **-s** \] \[ **-V** \] \[ **-v** \] \[ **-w** \]\
     \[ **-n** \] \[ **-p** \] \[ **-E** \] \[ **-c** \] \[ **-P** \] \[ **-m** *file\_name* \]\
     \[ **-I** *directory* \] \[ **-D** *name***=***def* \] \[ **-d** *option* \] \[ **-C** \]\
     \[ **--regular-c++** \]\
     \[  **--** *C++ compiler options* \] *source\_file*

## DESCRIPTION

**occ** applying a meta-level program to an OpenC++ program, and compiles the result program.

Full documentation can be found in */usr/share/doc/openc++*.

## OPTIONS

### MAIN OPTIONS

- **-g**

  Produce debugging information.

- **-M** *option***=***value*

  Specify an *option* with *value*.  It is passed to metaobjects.

- **-l**

  Print the list of statically loaded metaclasses.

- **-S** *metaclass*

  Load a metaclass.

- **-s**

  Print the whole parse tree of the given source program.  Don't perform translation or compilation.  If no source file is given, **occ** reads from the standard input.

- **-V**

  Show the version number.

- **-v**

  Specify the verbose mode.

- **-w**

  Enable wide characters support.

### BUILDING STAGES OPTIONS

- **-n**

  Suppress invoking the preprocessor.

- **-p**

  Stop after the parsing stage.  No translation is done.

- **-E**

  Don't run the back-end C++ compiler.  Stop after generating a .ii file.

- **-c**

  Suppress linking and produce a .o file.

- **-P**

  Preprocess again after translation.

- **-m** *file\_name*

  Produce a shared library (a .so file). This is used to compile a metaclass.  If *file\_name* is specified, the name of the shared library is *file\_name.so*.  If the **-c** option is specified together, **occ** produces a .so file, which should be linked by the user to be a shared library.

### PREPROCESSOR OPTIONS

- **-I** *directory*

  Add a *directory* to the search path of the #include directive.

- **-D** *name***=***def*

  Define a macro *name* as *def*.

- **-d** *option*

  Specify a preprocessor option

- **-C**

  Don't discard comments

### OTHER OPTIONS

- **--regular-c++**

  Inhibit the extended syntax.  This enables the keyword metaclass to be used as a variable name. This option is useful when parsing legacy code being not intended to translation.  When this option is used, the symbol \_\_opencxx is not defined.

- **--**

  The following options are interpreted as options for the back-end C++ compiler. For example, if you type:

  % occ -I.. -- -g foo.c

  Then the **-g** option is passed to the C++ compiler.  Note that these options are not passed to the C++ preprocessor.  The **-D** and **-I** options need to be placed before **--**.

## FILES

*file.{cc,C,c,cpp,cxx,mc}* source file.

*file.occ* output file after C++ preprocessing.

*file.ii* output file after translation.

*file.o* object file.

*file.so* shared library dynamically loaded by **occ**.

**/usr/lib/libocc.so** library to link with meta-level program.

## NOTES

While the C++ processor is running, the macro \_\_opencxx is predefined.

The programs compiled by **occ** do not need any runtime libraries or a garbage collector unless the meta-level program requires them at the base level.

## COPYRIGHT

Copyright (C) 1997, 1998 Shigeru Chiba.  All Rights Reserved.

Copyright (C) 1995, 1996 Xerox Corporation.  All Rights Reserved.

## AUTHOR

OpenC++ was initially written by Shigeru Chiba\<chiba@is.tsukuba.ac.jp\>, University of Tsukuba, Japan.  It is now further developped by a Grzegorz Jakacki \<jakacki@hed.com.cn\> and other people.

This manpage was initially written by John Lapeyre for the Debian GNU/Linux openc++ package, and was later reformated and updated by Yann Dirson.
