LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   compiling many .c files in to one .o file (https://www.linuxquestions.org/questions/linux-general-1/compiling-many-c-files-in-to-one-o-file-397459/)

kskkumar 12-29-2005 12:19 AM

compiling many .c files in to one .o file
 
Hi,

I want to compile more than one source files (.c files) in to a single object file (.o) file. i am using gcc compiler version

Cirdan 12-29-2005 01:45 AM

To do that you will need make a "Makefile" which is basicaly instructions to tell the computer how to compile a program.

Here are a few tutorials...
http://vertigo.hsrl.rutgers.edu/ug/make_help.html
http://www.opussoftware.com/tutorial/TutMakefile.htm
http://www.gnu.org/software/make/

also...
www.google.com/linux

biosx 12-29-2005 08:51 AM

You don't necessarily need a make-file. You can just tell gcc to use multiple source files like so:

gcc -o out.obj file1.c file2.c file3.c


All times are GMT -5. The time now is 02:15 PM.