Top / UserManual / 2_1
Compile †
This chapter describes how to compile COBOL programs using OpenCOBOL.
Compiler Options †
The compiler cobc accepts the options described in this section.
Build Target †
The following options specify the target type produced by the compiler:
- -E
- Preprocess only. Compiler directives are executed. Comment lines are removed. COPY statements are expanded. The output goes to the standard-out.
- -C
- Translation only. COBOL source files are translated into C files. The output is saved in file *.c.
- -S
- Compile only. Translated C files are compiled by cc. The output is saved in file *.s.
- -c
- Compile and assemble. This is equivalent to cc -c. The output is saved in file *.o.
- -m
- Compile, assemble, and build a dynamic-linking module (i.e., a shared library). The output is saved in file *.so. (Default)
- -x
- Compile, assemble, and build an executable.
Without any options above, the compiler tries to build an module.
If you give the -x option with -C, you will see the main function in the generated C file.
Source Format †
OpenCOBOL supports both fixed and free source format.
The default format is the fixed format. This can be explicitly overwritten by one of the following options:
- -free
- Free format.
- -fixed
- Fixed format.
Warning Options †
- -Wall
- Enable all warnings
- -Wcolumn-overflow
- Warn any text after column 72
- -Wend-evaluate
- Warn lacks of END-EVALUATE
- -Wend-if
- Warn lacks of END-IF
- -Wparentheses
- Warn lacks of parentheses around AND within OR
Counter: 40851,
today: 6,
yesterday: 14
Last-modified: Tue, 15 Jan 2008 05:10:38 GMT (1951d)
Last-modified: Tue, 15 Jan 2008 05:10:38 GMT (1951d)




