作者star1327p (sin30t)
看板EE_DSnP
標題[問題] 如果compile 沒過怎麼辦
時間Tue Jan 22 20:06:48 2008
如果compile 沒過怎麼辦?
我的程式碼,在最前面幾行就出狀況,
#include <iostream>
#include <iomanip>
#include <cstring>
#include <fstream>
#include <conio.h>
#include <cstdlib>
#include "Editor.h"
using namespace std;
Error message: expected unqualified-id before "namespace"
不太了解
還有另一個問題↓
void Editor::commandMode() // ask the user to put in the command
{
if (quitOrNot == false)
{
return;
printCommandLine();
}
while (true)
{
getline(cin,directive);
switch(directive)
{
case 'e': cout << endl; editMode(); break;
case 'h': cout << endl; help(); pause(); break;
case 'n': newFile(); break;
case 'o': openFile(); break;
case 'p': printText(); break;
case 'q': quit(); break;
case 's': saveFile(); break;
case 'S': saveFileAs(); break;
default:
system("cls");
cout << "INVALID directive input! Please input AGAIN!" << endl;
break;
} // end switch
} // end else
commandMode();
} // end function commandMode
Compiler 說 commandMode不能被overloaded
可是我覺得我沒有overload它
以上兩個問題,請好心人士回答,小的在此先說感謝喔
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.115.181.213
1F:推 timrau:Editor.h有沒有用#ifndef #define #endif包起來? 01/22 20:08
2F:→ star1327p:why? 01/22 20:31
3F:→ ilway25:有時候顯示a.cpp錯,但a.cpp include b.h,b.h又include c.h 01/22 22:53
4F:→ ilway25:錯可能在 c.h ... 我曾經這樣 debug 很久.. 01/22 22:53
5F:→ ilway25:ps.你的commandmode是無止盡recursion?? 記憶體會被吃光.. 01/22 23:01