注册 登录
编程论坛 C++教室

求教:提示头文件开头位置中缺少“;”是为什么?

mason 发布于 2008-09-28 21:04, 854 次点击
#ifndef Golf_H_
#define Golf_H_

const int Len=40;
struct golf
{
    char fullname[Len];
    int handicap;
};

void setgolf(golf & g,const char * name,int hc);

int setgolf(golf & g);

void handicap(golf & g,int hc);

void showgolf(const golf & g);

#endif

编译时总是说:syntax error : missing ';' before 'const'

这是为什么?
6 回复
#2
maillane2008-09-28 22:18
没有啊。。。。
OS:windows
IDE:visual studio 2005
#3
blueboy820062008-09-28 22:50
不知道具体是哪出了问题,
我用VC6.0编译没问题...
#4
shaoda1692008-09-29 12:10
回复 1# mason 的帖子
还是编译器版本的问题
#5
p1s2008-09-29 12:32
看看你#include的源文件附近的代码
#6
God_WangY2008-10-01 17:38
看你的代码 没什么问题
#7
守鹤2008-10-01 18:50
这里好像没用到
const int Len=40;

把它放在主文件中试试
1