关于C++遇到的一个问题,求解决。
从书上抄的一个程序:# include<iostream.h>
# include<time.h>
class Time
{
private:
int hr,min,sec;
public:
Time();
void Reset(int h,int m,int s);
void ShowTime();
};
Time::Time()
{
hr=min=0;
sec=1;
}
void Time::Reset(int h,int m,int s)
{
hr=h;
min=m;
sec=s;
}
void Time::ShowTime()
{
cout<<"\n Time 对象:"<<hr<<":"<<min<<":"<<sec;
}
void SetTimeObject(Time *pWatch);
int main()
{
Time MyWatch;
cout<<"\n几点了?\n\n";
SetTimeObject(&MyWatch);
MyWatch.ShowTime();
cout<<"\n\n结束,谢谢!\n\n";
return 0;
}
在VC6.0运行时总是提示:Linking...
1.obj : error LNK2001: unresolved external symbol "void __cdecl SetTimeObject(class Time *)" (?SetTimeObject@@YAXPAVTime@@@Z)
Debug/first6.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
求高手帮忙解决,小弟感激不尽。