T
Tomás Ó hÉilidhe
I'd post this on a gcc newsgroup but I'd be more productive talking
to the wall.
Anyway, let's say someone throws some source code at you for a
particular program and says, "Just compile it, it works fine". Now
admittedly, I tend to have a phobia of this situation because I recall
from my Windows days the numerous times I was given code that was
supposedly "good to go", but which failed to compile for some stupid
reason. Of course I like to program, but I couldn't be bothered going
through header files looking for the dodgy definition of DWORD which is
hidden within #if blocks pertaining to the Windows version.
Anyway, pretending I have faith for a moment in receiving a program's
source code to compile to yield an executable binary, I'd just like to
ask how best to compile it "in release mode" using gcc. I don't need
errors or warnings, I just want the executable.
At the moment, I'm unzipping the zip file, opening a command prompt
in the relevant directory and doing the following:
gcc *.c -D NDEBUG -o prog.exe
I'm looking for a gcc command line sequence that does the following:
* Compiles and links all the source files (*.c) present in the current
directory.
* Applies any and all optimisations it wants.
* Doesn't give me warnings (or any output for that matter)
* Strips all the garbage out of the executable (HelloWorld shouldn't be
400 KB)
The method I'm using at the moment does the trick, but still the
executable file is a bit big (roughly 25 KB for a simple-enough program).
Also, I'd like to know that I'm getting all the optimisations that are on
offer.
I'm getting into cross-platform programming lately, compiling
something for Linux one minute and Windows the other, which is why I've
been wondering what's the best "Give Me An Executable" method of using
gcc.
And just out of curiosity, is gcc restricted mainly to normal 8-Bit
byte system, or does it have binaries for all sorts of different systems,
9-Bit ones with padding inside a sign-magnitude int perhaps?
to the wall.
Anyway, let's say someone throws some source code at you for a
particular program and says, "Just compile it, it works fine". Now
admittedly, I tend to have a phobia of this situation because I recall
from my Windows days the numerous times I was given code that was
supposedly "good to go", but which failed to compile for some stupid
reason. Of course I like to program, but I couldn't be bothered going
through header files looking for the dodgy definition of DWORD which is
hidden within #if blocks pertaining to the Windows version.
Anyway, pretending I have faith for a moment in receiving a program's
source code to compile to yield an executable binary, I'd just like to
ask how best to compile it "in release mode" using gcc. I don't need
errors or warnings, I just want the executable.
At the moment, I'm unzipping the zip file, opening a command prompt
in the relevant directory and doing the following:
gcc *.c -D NDEBUG -o prog.exe
I'm looking for a gcc command line sequence that does the following:
* Compiles and links all the source files (*.c) present in the current
directory.
* Applies any and all optimisations it wants.
* Doesn't give me warnings (or any output for that matter)
* Strips all the garbage out of the executable (HelloWorld shouldn't be
400 KB)
The method I'm using at the moment does the trick, but still the
executable file is a bit big (roughly 25 KB for a simple-enough program).
Also, I'd like to know that I'm getting all the optimisations that are on
offer.
I'm getting into cross-platform programming lately, compiling
something for Linux one minute and Windows the other, which is why I've
been wondering what's the best "Give Me An Executable" method of using
gcc.
And just out of curiosity, is gcc restricted mainly to normal 8-Bit
byte system, or does it have binaries for all sorts of different systems,
9-Bit ones with padding inside a sign-magnitude int perhaps?