occ − OpenC++ compiler


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


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++.




Produce debugging information.

-M option=value

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


Print the list of statically loaded metaclasses.

-S metaclass

Load a metaclass.


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.


Show the version number.


Specify the verbose mode.


Enable wide characters support.



Suppress invoking the preprocessor.


Stop after the parsing stage. No translation is done.


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


Suppress linking and produce a .o file.


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 If the -c option is specified together, occ produces a .so file, which should be linked by the user to be a shared library.


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


Don’t discard comments


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 --.


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. shared library dynamically loaded by occ.

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


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 (C) 1997, 1998 Shigeru Chiba. All Rights Reserved.

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


OpenC++ was initially written by Shigeru Chiba<chiba [AT]>, University of Tsukuba, Japan. It is now further developped by a Grzegorz Jakacki <jakacki [AT]> 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.