0% found this document useful (0 votes)
13 views

05-4-compilers-2

Uploaded by

JohnKevinStanley
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

05-4-compilers-2

Uploaded by

JohnKevinStanley
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Advanced Programming in the

UNIX Environment
Week 05, Segment 4:
Unix Development Tools:
The Compiler Chain, Part II

Department of Computer Science


Stevens Institute of Technology

Jan Schaumann
[email protected]
https://stevens.netmeister.org/631/
CS631 - Advanced Programming in the UNIX Environment

Compilers

00101001011100110101110011010101101011010
110011010110101100110010101101101101010011

#include <stdio.h>

int
main(int argc, char **argv) {
printf(“Hello, World!\n”);
}

Jan Schaumann 2021-09-10


CS631 - Advanced Programming in the UNIX Environment

The GNU Compiler Collection

preprocessing (e.g. via cpp(1)),


The compiler chain or driver usually performs preprocessing
compilation assembly (as(1)) and linking
compilation (cc(1)), assembly linking (ld(1)).

void perror(const char *);
/usr/include/stdio.h int printf(const char * __restrict, …)
__print ike(1, 2);
int putc(int, FILE *);
#include <stdio.h> int putchar(int);
#de ne NUM 42 …

int int
main(int argc, char **argv) { main(int argc, char **argv) {
printf(“%d\n”, NUM); printf(“%d\n”, 42);
} }
Jan Schaumann 2021-09-10
fi
fl
CS631 - Advanced Programming in the UNIX Environment

The GNU Compiler Collection

The compiler chain or driver usually performs preprocessing (e.g. via cpp(1)),
compilation (cc(1)), assembly (as(1)) and linking (ld(1)).

• use cpp(1) to manually preprocess .c les

• use “-D” to de ne macros on the command-line

• use “cc -v” to see the compilers stages and the commands it executes

To be continued…

Jan Schaumann 2021-09-10


fi
fi

You might also like