Compiling

Topics: Programming language, Computer program, Source code Pages: 129 (18744 words) Published: October 4, 2013
gcc -o / -O option flags
gcc -o writes the build output to an output file.
gcc -O sets the compiler's optimization level.
gcc -o option flag
gcc -O option flag
gcc -o option flag
Write the build output to an output file.
Syntax
$ gcc [options] [source files] [object files] -o output file Example
myfile.c:
// myfile.c
#include

void main()
{
printf("Program run\n");
}

Build myfile.c on terminal and run the output file myfile:
$ gcc myfile.c -o myfile
$ ./myfile
Program run
$

gcc -O option flag
Set the compiler's optimization level.
optionoptimization levelexecution timecode sizememory usagecompile time -O0optimization for compilation time (default)++--
-O1 or -Ooptimization for code size and execution time--++ -O2optimization more for code size and execution time-- +++ -O3optimization more for code size and execution time--- ++++ -Osoptimization for code size -- ++

-OfastO3 with fast none accurate math calculations--- ++++ +increase ++increase more +++increase even more -reduce --reduce more ---reduce even more Syntax
$ gcc -Olevel [options] [source files] [object files] [-o output file] Example
myfile.c:
// myfile.c
#include

void main()
{
printf("Program run\n");
}

Build myfile.c on terminal and run the output file myfile:
$ gcc -O myfile.c -o myfile
$ ./myfile
Program run
$

gcc -o / -O option flags
gcc -o writes the build output to an output file.
gcc -O sets the compiler's optimization level.
gcc -o option flag
gcc -O option flag
gcc -o option flag
Write the build output to an output file.
Syntax
$ gcc [options] [source files] [object files] -o output file Example
myfile.c:
// myfile.c
#include

void main()
{
printf("Program run\n");
}

Build myfile.c on terminal and run the output file myfile:
$ gcc myfile.c -o myfile
$ ./myfile
Program run
$

gcc -O option flag
Set the compiler's optimization level.
optionoptimization levelexecution timecode sizememory usagecompile time -O0optimization for compilation time (default)++--
-O1 or -Ooptimization for code size and execution time--++ -O2optimization more for code size and execution time-- +++ -O3optimization more for code size and execution time--- ++++ -Osoptimization for code size -- ++

-OfastO3 with fast none accurate math calculations--- ++++ +increase ++increase more +++increase even more -reduce --reduce more ---reduce even more Syntax
$ gcc -Olevel [options] [source files] [object files] [-o output file] Example
myfile.c:
// myfile.c
#include

void main()
{
printf("Program run\n");
}

Build myfile.c on terminal and run the output file myfile:
$ gcc -O myfile.c -o myfile
$ ./myfile
Program run
$
gcc -o / -O option flags
gcc -o writes the build output to an output file.
gcc -O sets the compiler's optimization level.
gcc -o option flag
gcc -O option flag
gcc -o option flag
Write the build output to an output file.
Syntax
$ gcc [options] [source files] [object files] -o output file Example
myfile.c:
// myfile.c
#include

void main()
{
printf("Program run\n");
}

Build myfile.c on terminal and run the output file myfile:
$ gcc myfile.c -o myfile
$ ./myfile
Program run
$

gcc -O option flag
Set the compiler's optimization level.
optionoptimization levelexecution timecode sizememory usagecompile time -O0optimization for compilation time (default)++--
-O1 or -Ooptimization for code size and execution time--++ -O2optimization more for code size and execution time-- +++ -O3optimization more for code size and execution time--- ++++ -Osoptimization for code size -- ++

-OfastO3 with fast none accurate math calculations--- ++++ +increase ++increase more +++increase even more -reduce --reduce more ---reduce even more Syntax
$ gcc -Olevel [options] [source files] [object files] [-o output file] Example
myfile.c:
// myfile.c...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay about The Compiling of Quran
  • Compiling a Data Base Essay
  • A Report on “Compiling Consumer’s Attitude Towards Brands” Essay

Become a StudyMode Member

Sign Up - It's Free