Mail Archives: djgpp/1999/08/26/01:05:07
In article <7purvn$j7h$1 AT nclient11-gui DOT server DOT virgin DOT net> you wrote:
> I wanted to compile C++ code into an executable with optimisations.
> In this case, it is a tiny program called "keypress.cpp"
> (pasted at the end of this message).
> It compiles fine with -
> > gxx -o keypress.exe keypress.cpp
> but complains with -
> > gxx -O2 keypress.exe keypress.cpp
That's because there's a major error in that command line. It ought
to have been
gxx -O2 -o keypress.exe keypress.cpp
The '-O2' is one option, and '-o keypress.exe' is another one. These
two have almost nothing to do with each other:
'-O2' means: optimize the code
'-o keypress.exe' means: call the resulting program 'keypress.exe', instead
of the default 'a.exe' (and 'a.out').
Your command line is interpreted as:
compile keypress.c (to keypress.o)
then link keypress.exe and keypress.o, forming the new program 'a.exe'
Obviously, that can't work, as keypress.exe is not usable as a part of
a program, it's a full program on its own.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -