错误:在'void'之前预期'=',',',';','asm'或'__attribute__'

时间:2012-06-20 04:01:23

标签: c function compiler-errors

我已经在网络上看到过几次这个错误,但我从未见过解决方案而且我得到了它。

错误:

C:\Users\Jake\Desktop\FightingChance\Fighting_Screen.c:3:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'

以下是代码:

#include "main.h"
///////////////////////////////////////////////////////////////////////////////////////////
void prefight(void)
{
     system("cls");
     printf("%s:\n\nScore = %ld \n\nYour Pre-Fight Stats:\n\nStrength = %ld \nToughness = %ld \nHealth = %d\n\n",name,UserStats[0],UserStats[1],UserStats[2],Userpre_health);
     printf("\n\nEnemy:\n\nYour Enemies Pre-Fight Stats:\n\nStrength = %ld \nToughness = %ld \nHealth = %d\n\n",EnemyStats[1],EnemyStats[2],Enemypre_health);
     printf("\nPress any key to return to menu");
     getch();
}
///////////////////////////////////////////////////////////////////////////////////////////
...

我非常感谢您的帮助,如果您需要更多信息或代码让我知道...提前感谢!

1 个答案:

答案 0 :(得分:5)

检查头文件main.h.你可能忘了在那里放一个分号。