// test619.cpp : Defines the entry point for the console application.
//#include "stdafx.h"
#include <iostream>
#include <string>
#include <list>
using namespace std;
class Employee{
  string first_name;
  string family_name;
  short department;
  
public :
Employee(const string  name,int dept);
virtual void print() const;
};
void Employee::print() const
{
   cout<<family_name <<'\t'<<department<<'\n';
}class Manager : public Employee{
  list<Employee * >group ;
  short level;public:
  Manager(const string& name, int dept,int lvl);
  void print() const;
};void Manager::print() const
{
Employee ::print();
cout<<"\tlevel"<<level <<'\n';
}void print_list(const list<Employee *>& s)
{
for (list<Employee *> ::const_iterator p = s.begin();p!=s.end();++p)
(*p)->print();
}
int main(int argc, char* argv[])
{
Employee e("Brownn",1234);
Manager m("Smith",1234,2);
list<Employee*> empl;
empl.push_front(&e);
empl.push_front(&m);
print_list(empl); return 0;
}
==================================--------------------Configuration: test619 - Win32 Debug--------------------
Compiling...
test619.cpp
Linking...
test619.obj : error LNK2001: unresolved external symbol "public: __thiscall Manager::Manager(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int,int)" (??0Manager@@QAE@ABV?$basic_string@DU?$char_traits
@D@std@@V?$allocator@D@2@@std@@HH@Z)
test619.obj : error LNK2001: unresolved external symbol "public: __thiscall Employee::Employee(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (??0Employee@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$
allocator@D@2@@std@@H@Z)
Debug/test619.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.test619.exe - 3 error(s), 0 warning(s)

解决方案 »

  1.   

    可能是你实现文件没有,要不就是lib文件没调入
      

  2.   

    我没有调用什么lib文件呀?
      

  3.   

    class Employee{
    public:
      string first_name;
      string family_name;
      short department;
      
    public :
    Employee(const string  name,int dept);
    virtual void print() const;
    };
    构造函数没有实现函数体
      

  4.   

    class Employee 及class  Manager的构造都没有实现