130 likes | 265 Views
OS Homework #2. How to finish it ?. Compile. GNU C Compiler (GCC) Please use gcc file .c -o file -o option specify execute file instead of a.out For C++? g++. Compile. Compile one file and exe gcc hello.c -o hello ./hello Compile multiple files gcc main.c fn_hello.c -o newhello.
E N D
OS Homework #2 How to finish it ?
Compile • GNU C Compiler (GCC) • Please use gcc file.c -o file • -o option specify execute file instead of a.out • For C++? g++
Compile • Compile one file and exe • gcc hello.c -o hello • ./hello • Compile multiple files • gcc main.c fn_hello.c -o newhello
Compile • Creating object files • Use –c option • gcc -c main.c • gcc -c fn_hello.c • gcc main.o fn_hello.o -o hello • Link Order?
Makefile • dependency
Debug • Warning? • Segmentation Fault? • DDD (Data Display Debugger) • GDB (GNU Debugger)
Homework • 1. producer-consumer • 2. fibonacci • 3. fibonacci using share memory • 4. simple popen • 5. mini-mini shell (optional)
Resource • Please see http://www.cmlab.csie.ntu.edu.tw/~xdd/OS07/resources.html