linux c++ programming

I've created a program in c++ that converts celsius to farenheit and vice versa. This program has two conversion functions and each function is it's own separate file. How do I compile each file seperately using the CC commands and create an object file? Also how can I create a file to compile all files?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have a look at the following tutorial:

Here's the totorials for *nix programming:
maybe what you need is a "Make tutorial"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I suppose your main program is 'main.cpp' and your 2 functions are in the files 'celsius.cpp' and 'farenheit.cpp' respectively and the celsius.h and farenheit.h for the prototype functions. If your program is C++ then you have to use 'c++' command, and if your proram is C then you can use 'cc' command,

To compile each file to an object file,
$ c++ -c celsius.cpp         => Automatically create celsius.o
$ c++ -c farenheit.cpp   => Automatically create farenheit.o
$ c++ -c main.cpp  => Automatically create main.o

To link to the executable file,
$ c++ celsius.o farenheit.o main.o -o main => Create the executable file main

To create a file that automatically does the process above, create a new file called 'Makefile' or 'makefile' (Remember that the filename must be the same). The content of the file is below

all:      main

celsius.o:      celsius.c celsius.h
      c++ -c celsius.c

farenheit.o:      farenheit.c farenheit.h
        c++ -c farenheit.c

main.o:     main.c
       c++ -c main.c

main:      celsius.o farenheit.o main.o
      c++ celsius.o farenheit.p main.o -o main

      rm *.o main

Then just type 'make' to compile all the files, and type 'make clean' to delete all the files .o and main program.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.