[Gllug] c++ newbie complier probs

Sean Burlington sean at uncertainty.org.uk
Tue Oct 22 19:43:25 UTC 2002


I wonder if anyone can help me with what I think is a compiler problem

I have a simple program which has to use a class provided as part of a 
reference library from the relavent textbook (computing concepts with 
c++ essentials)

#include <iostream>
#include <iomanip>
using namespace std;
#include <ccc_empl.h>

bool same_name(Employee a, Employee b)
{
   return  a.get_name() == b.get_name();
}

int main(void)
{

   Employee a("fred",1.0);
   Employee b("wilma",1.0);
   if (same_name(a, b))
     cout << "Same Name" << endl;
   else
     cout << "different" << endl;
}

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_string<char, 
std::char_traits<char>, std::allocator<char> >, double)'
/tmp/ccLFm4QL.o(.text+0x18e): undefined reference to 
`Employee::Employee[in-charge](std::basic_string<char, 
std::char_traits<char>, std::allocator<char> >, double)'
collect2: ld returned 1 exit status


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




More information about the GLLUG mailing list