class ARouter {
enum directions {north, neast, east, seast, south, swest, west, nwest};
static directions gon[] = {north, neast, nwest, east, west, seast, swest, south};
};
嗨,有沒有人知道什麼是上述代碼的問題?C++數組初始值設定項。使用枚舉類型
我收到2個錯誤用於從VC++ 2008Ex的第二行:
錯誤C2059:語法錯誤: '{'
錯誤C2334:意外的標記(一個或多個)之前 '{' ;跳過明顯的功能機構
這些行沒有任何錯誤。您可能會在文件中出現語法錯誤,這會導致編譯器感到困惑。或者,也許你正在將變量定義在無效的地方,就像在課堂內部一樣。 –
發佈更多代碼,它編譯在我的最後。 – Drake
沒有錯AFAIK;你的代碼在g ++ 4中工作正常。 –