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

Bev*_*qua 0 c compiler-errors function

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

错误:

C:\Users\Jake\Desktop\FightingChance\Fighting_Screen.c:3:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
Run Code Online (Sandbox Code Playgroud)

这是代码:

#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();
}
///////////////////////////////////////////////////////////////////////////////////////////
...
Run Code Online (Sandbox Code Playgroud)

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

Jas*_*ski 5

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