为什么不能调用类?
vmape 2003-07-30 03:41:49 我写了一个类的例子,包含有三个文件class.h class.cpp run.cpp
为什么我在class.cpp中加入main()然后编译就能正常的运行,在run.cpp中调用类就不能通过呢?DEV-c++提示说:
[Linker error] undefined reference to `family::family()'
[Linker error] undefined reference to `family::display()'
[Linker error] undefined reference to `family::~family()'
是不是我声明头文件出错了?在run.cpp中,我是这么写头文件的。
#include "class.h"
#include <cstdlib>
using namespace std;
谢谢大家帮忙!