[prog] C++ Inheritance
Sue Stones
suzo at bigpond.net.au
Sun May 25 21:54:31 EST 2003
After wallowing in my subconcious for a day this suddenly makes full sence.
thanks for the the light switch!
sue
On Sat, 24 May 2003 18:07, Mary wrote:
> There are two ways to compile C++ (and C) programs. Either you compile
> every file you need at once:
>
> g++ -o [executable name] [filenames]
>
> eg: g++ -o myprog *.C
>
> or you compile each file one by one into an object file (with the -c
> flag, which tells g++ not to attempt to link the output of this compile
> together into a working program) and then link them together:
>
> eg: g++ -o myfile.o -c myfile.C
> g++ -o myfile2.o -c myfile2.C
>
> g++ -o myprog myfile.o myfile2.o
>
> If you don't use the -c flag, g++ will try and link your program into a
> working executable, and myfile.C won't compile into a working
> execuatable if it relies on functions implemented in myfile2.C
>
> Incidently, the reason you can make object files and link them all
> together later is this: imagine you have a project that takes 12 hours
> to compile. You change 1 line. You wish to test it. Instead of doing the
> entire 12 hour compile again, you recompile that file into an object
> file, and then do the linking step with all the other object files that
> are unchanged from old compiles.
>
> -Mary
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/programming
More information about the Programming
mailing list