| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 610 人关注过本帖
标题:小事情————呵呵
只看楼主 加入收藏
天煞孤星
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2005-6-7
收藏
 问题点数:0 回复次数:2 
小事情————呵呵

大家好!最近就是烦的要命调什么都不行!这不下面的就是出现的错误! Linking... 1.obj : error LNK2001: unresolved external symbol "public: void __thiscall DigitalTime::advance(int)" (?advance@DigitalTime@@QAEXH@Z) 2.obj : error LNK2001: unresolved external symbol "public: void __thiscall DigitalTime::advance(int)" (?advance@DigitalTime@@QAEXH@Z) Debug/2.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe.

2.exe - 3 error(s), 0 warning(s) 请问师哥师姐怎样解决啊!

2005-06-07 01:48
C++大粉丝
Rank: 4
等 级:贵宾
威 望:10
帖 子:477
专家分:0
注 册:2004-4-23
收藏
得分:0 
你只在.H文件里写了声明,没有在.CPP文件里写实现.

I am a big fan of c plus plus.
2005-06-07 17:12
天煞孤星
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2005-6-7
收藏
得分:0 

老师好!可是我还是不知道怎样做啊!??看来我还是真的笨啊!怎样子改我我把我的源程序给你看看,说是在的我是在调书本上的 啊! #include<iostream.h> #include<ctype.h> #include<stdlib.h> #include "dtime.h" void read_hour(istream& ins,int& the_hour); void read_minute(istream& ins,int& the_minute); int digit_to_int(char c); bool operator ==(const DigitalTime& time1,const DigitalTime& time2) { return(time1.hour ==time2.hour && time1.minute ==time2.minute); } DigitalTime::DigitalTime(int the_hour,int the_minute) { if(the_hour < 0 || the_hour >23 || the_minute < 0 || the_minute >59) { cout<<"the illegal is 错误:"; exit(1); } else { hour = the_hour; minute = the_minute; } } DigitalTime::DigitalTime() : hour(0),minute(0) { //主体为空 } void DigitalTime::advance(int hours_added,int minutes_added) { hour = (hour + hours_added)%24; advance(minutes_added); } ostream& operator << (ostream& outs,const DigitalTime& the_object) { outs<<the_object.hour<<':'; if(the_object.minute <10) outs<<'0'; outs<<the_object.minute; return outs; } istream& operator >>(istream& ins,DigitalTime& the_object) { read_hour(ins,the_object.hour); read_minute(ins,the_object.minute); return ins; } int digit_to_int(char c) { return (int (c) -int('0')); } void read_minute(istream& ins,int& the_minute) { char c1,c2; ins>>c1>>c2; if(!(isdigit(c1) &&isdigit(c2))) { cout<<"error illegal input\n"; exit(1); } the_minute = digit_to_int(c1)*10 + digit_to_int(c2); if(the_minute <0 || the_minute>59) { cout<<"error illegal input"; exit(1); } } void read_hour(istream& ins,int& the_hour) { char c1,c2; ins >>c1>>c2; if(!(isdigit(c1) && (isdigit(c2)||c2 ==':'))) { cout<<"error illegal input"; exit(1); } if(isdigit(c1) && c2 == ':') { the_hour = digit_to_int(c1); } else { the_hour = digit_to_int(c1)*10 + digit_to_int(c2); ins >>c2; if(c2!=':') { cout<<"error illegal input"; exit(1); } } if(the_hour <0|| the_hour >23) { cout<<"error the illegal input"; exit(1); } }

#include<iostream.h> class DigitalTime { public: friend bool operator==(const DigitalTime& time1,const DigitalTime& time2); DigitalTime(int the_hour,int the_minute); DigitalTime(); void advance(int minutes_added); void advance(int hours_added,int minutes_added); friend istream& operator >>(istream& ins, DigitalTime& the_object); friend ostream& operator <<(ostream& outs,const DigitalTime& the_object); private: int hour; int minute; }; #include<iostream.h> #include "dtime.h" int main() { DigitalTime clock,old_clock; cout<<"enter the time in 24 hour :"; cin >>clock; old_clock = clock; clock.advance(15); if(clock ==old_clock) cout<<"something is wrong."; cout<<"you entered"<<old_clock<<endl; cout<<"15 minute later the time will be" <<clock<<endl; clock.advance(2,15); cout<<"2 hour and 15 minute after that\n" <<"the time will be" <<clock<<endl; return 0; } 这是个3个文件独立编译的,请老师在帮忙好么。先谢谢了!!呵呵


虽然我现在不够强,但我知道我会的,终究会有那一天,我相信我自己能行的!!只要我付出了,我就会得到回报!!
2005-06-07 18:56
快速回复:小事情————呵呵
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014285 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved