作者james0419 (阿富)
看板EE_DSnP
标题Re: [问题] 杂七杂八的问题...
时间Mon Jan 19 15:29:46 2009
我有一个class 叫Typing,
但是我在main.cpp compile的时候出现了以下的error....
[Linker error] undefined reference to `Typing::getAKey()'
我的原始码如下
...
void Typing::getAKey(){
while(!cin.eof()){
while(!kbhit()){cout.flush();
}
safecin(getch());
}
...
char j[80];
for(int h=0;h<80;++h){
Typing type;
type.getAKey();
cin>>j;
cout<<j[h];
cout.flush();
}
...
istream& Typing::safecin(char a){
// is.get(a);
while(cin.fail())
{
...(反正就是老师上课讲过的...)
我在想是不是因为constructor没有把cin当参数吃进来
(因为我根本没定义constructor)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.254.4.249
1F:→ james0419:不过我发现 getch 和 kbhit都是conio.h的东西 01/19 15:35
2F:→ james0419:但是他们就当成global function 来呼叫?? 01/19 15:36
3F:推 ric2k1:Typing::getAKey() 写在 main.cpp 吗? 还是其他档案? 01/19 22:24
4F:→ ric2k1:若是其他档案要记得开 project 来 compile 哦! 01/19 22:24