Command line options of C++ compilers
Equivalences in options for free C++ compilers: Visual C++, BCC 5.5, MingW
and GCC, Open Watcom. This page is not a manual, you must read the manual
of the compiler for a complete description and role of each option. You have
to read the manuals for additionals options also.
The <xxx> string means that the angle-brackets enclose some kind of
thing, the whole must be replaced by a real name.
Option | Visual C++ | BCC 5.5 | GCC |
---|---|---|---|
Display help | /? | No parameter. | -h --help |
Minimize space | /O1 | -Ox | -Os |
Maximize speed | /O2 | -Ox | |
Disable optimizations | /Od | -O- | |
Inline expansion | /Ob | Default, disable by -fno-default-inline |
|
Check only syntax | /Zs | -fsyntax-only | |
Line number debugging info | /Zd | -y | default -P remove |
Compile only, no link | /c | -c | -c |
Disable warnings | /w | -w- | |
Linking with MSCVRT.LIB | /MD | ||
Linking with LIBCMT.LIB | /MT | ||
Create a DLL | /DL | -mdll | |
Create Windows application | /GA | -tW | -mwindows |
Create console application | -mconsole | ||
Set stack size | /F
|
--stack<size> | |
Default char type is unsigned | /J | -K | -funsigned-char |
Allow nested comments | -C | Default | |
Include files directory | /l | -I<directory> | -l<directory> |
Libraries directory | -L<directory> | ||
Force C++ compile | /TP | -P | -xc++ |
Output file or directory | -n<directory> | -o<file> | |
Pentium Instructions | /G5 or /G6 | -5 or -6 | -mpentium or -mpentiumpro |
Executable file name | /Fe<filename> | -e<filename> | |
Merge duplicate strings | -d | ||
Define macros | /D<name> | -D<name> | -D<name> |
Undefine macro | /U<name> | -U<name> | -U<name> |
No header display | /nologo | ||
Enable C++ EH | /GX | ||
Disable extensions (as floating point) | /Za | -Ax | -mno-soft-float |
External symbols have a leading underscore | Default -u- disables |
-fleading-underscore | |
Enable exception handling | -x<exception> | -fexceptions | |
Warn when a variable is unused | Default | Default | -Wunused |