看板 EE_DSnP 關於我們 聯絡資訊
我有一個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
james0419:不過我發現 getch 和 kbhit都是conio.h的東西 01/19 15:35
james0419:但是他們就當成global function 來呼叫?? 01/19 15:36
ric2k1:Typing::getAKey() 寫在 main.cpp 嗎? 還是其他檔案? 01/19 22:24
ric2k1:若是其他檔案要記得開 project 來 compile 哦! 01/19 22:24