[Gllug] c++ newbie complier probs

Pete Ryland pdr at pdr.cx
Tue Oct 22 20:06:15 UTC 2002


On Tue, Oct 22, 2002 at 09:36:32PM +0100, Sean Burlington wrote:
> Pete Ryland wrote:
> >These are linker errors.  Add a "-c" to your g++ line to just compile to
> >a .o file instead.
> 
> It does complie without error if I do that
> 
> I kind of wanted an executable though ...
> 
> is there either a way of running a .o file (sounds unlikely - but I am 
> new to creating these things) - or am I doing something wrong which is 
> causing the linker errors ?

Ah, then you will need to link all the .o files together.  Doing something
like:

g++ -o myprogname module1.o module2.o module3.o

should work if you aren't using any external libraries (besides std ones).

You will need to link in the .o for the employee class to avoid the error
you were getting before.

hth,
Pete

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list