【发布时间】:2015-01-06 22:19:02
【问题描述】:
我在发布这个问题之前检查了互联网,我发现的答案是我可能缺少括号。
int main (void) {
int input = 0;
while(input != 3) {
printf("Please select an implementation :"
"\n1. Linked list implementation"
"\n2. Ring buffer implementation"
"\n3. Exit");
fflush(stdout);
scanf("%d",&input);
switch(input) {
case 1: printf("Linked List");
break;
case 2: printf("Ring Buffer");
break;
case 3: printf("Goodbye!");
break;
}
}
return 0;
}
我删除了案例中的所有代码以使其更短,但我仍然收到错误消息。更具体地说:
在int main(void) { 的行我得到了错误
'main' is normally a non-static function [-Wmain]
在最后的} 行我收到错误:
expected declaration or statement at end of input
我尝试清理并刷新,再次构建项目,我还重新启动了计算机,但没有任何改变。
非常感谢!
【问题讨论】:
标签: c switch-statement syntax-error main