【发布时间】:2012-03-29 12:53:19
【问题描述】:
嘿,我不确定我是否犯了语法错误,但我创建了一个类,当我尝试编译它时得到这个错误....
dining.h:7:1: error: unknown type name ‘class’
dining.h:7:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
它在 g++ 上运行良好,但我必须使用 gcc...
这是问题代码..
#ifndef DINING_H
#define DINING_H
class DiningSet {
public:
DiningSet();
~DiningSet();
void getSize(); // accepts X and Y dimentions of the table (in metres)
//void surfaceArea(int,int); // Calculates Surface Area of table (in square metres)
void numChairs(); // accepts number of chairs
void cushionColour(); // accepts a cushion colour
void woodType(); // accepts wood type
void priceComp(); // computes a price of set
void purchaseDet(); // displays details of purchase
void purchasePrice(); // displays price of purchace
private:
int X, Y; // Dimentions of table
float Surface;
int chairs; // Number of chairs
char colour; // colour of cushion (should be dynamic array)
char wood;
float totalPrice;
};
#endif
【问题讨论】:
-
请显示您当前使用的命令行。
标签: c++ class gcc compilation cc