+ 1
How do i link a two program in c ?
Can you explain with example plse
1 Answer
+ 2
Using gcc you can write:
gcc main.c file1.c file2.c file3.c ... filen.c
in the command prompt.
If you want to name the output file go for this:
gcc main.c file1.c -o outputfilename
With optimizations:
gcc main.c file1.c -O3 -o outputfilename
Or compile each of them to a .o and then use the .o to compile the exe:
gcc -c main.c
gcc -c file1.c
and now link them:
gcc main.o file1.o -o outputfilename
Heres a link where you can see more command line options:
http://tigcc.ticalc.org/doc/comopts.html