[Gllug] c++ newbie complier probs

Sean Burlington sean at uncertainty.org.uk
Tue Oct 22 20:36:32 UTC 2002


Pete Ryland wrote:

> On Tue, Oct 22, 2002 at 08:43:25PM +0100, Sean Burlington wrote:
>
> >I am using gcc 3.1
> >/usr/local/bin/g++ -Wall \
> >-I/home/sean/projects/c++/bb/horstman/cccfiles/  4.cpp
> >
> >and get the following output
> >(I'm confused - other programs using the same included files work fine
> >I think I am missing something obvious )
> >
> >/tmp/ccLFm4QL.o: In function `same_name(Employee, Employee)':
> >/tmp/ccLFm4QL.o(.text+0x18): undefined reference to
> >`Employee::get_name() const'
> >/tmp/ccLFm4QL.o(.text+0x2a): undefined reference to
> >`Employee::get_name() const'
> >/tmp/ccLFm4QL.o: In function `main':
> >/tmp/ccLFm4QL.o(.text+0xf8): undefined reference to
> >`Employee::Employee[in-charge](std::basic_stringstd::char_traits, 
> std::allocator >, double)'
> >/tmp/ccLFm4QL.o(.text+0x18e): undefined reference to
> >`Employee::Employee[in-charge](std::basic_stringstd::char_traits, 
> std::allocator >, double)'
> >collect2: ld returned 1 exit status
>
>
> These are linker errors.  Add a "-c" to your g++ line to just compile to a
> .o file instead.
>
> Pete
>
thanks Pete

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 ?

Sean


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




More information about the GLLUG mailing list