1

私は Eclipse CDT を使用しており、gotoその後にラベルと FILE 定義があり、プロジェクトをコンパイルするとエラーが表示されます: Expression expected before FILE.

前もってありがとう、マンさん

編集:

わかりました、これは私がコマンドラインから得たものです:

iOS.c: In function ‘main’:
iOS.c:45: error: expected expression before ‘FILE’
iOS.c:49: error: ‘preFile’ undeclared (first use in this function)
iOS.c:49: error: (Each undeclared identifier is reported only once
iOS.c:49: error: for each function it appears in.)`

そして、これはコードがエラーをスローするものです:

fileExists:

FILE *preFile = fopen("prefix.txt","r");
4

1 に答える 1

3

C でコーディングしているため、関数の先頭で変数を宣言する必要があります。

void foo()
{
  FILE* preFile;

  // some code

  fileExists:
  preFile = fopen("prefix.txt","r");
}
于 2010-03-27T20:00:44.407 に答える