makefileとは何の関係もありません。ISO C90は、ブロックまたはファイルの先頭以外の場所で変数を宣言することを禁じています-このように
int main(int argc, char **argv) {
int a; /* Ok */
int b = 3; /* Ok */
printf("Hello, the magic number is %d!\n", b);
int c = 42; /* ERROR! Can only declare variables in the beginning of the block */
printf("I also like %d.. but not as much as %d!\n", c, b);
return 0;
}
したがって、これに変更する必要があります...
int main(int argc, char **argv) {
int a; /* Ok */
int b = 3; /* Ok */
int c = 42; /* Ok! */
printf("Hello, the magic number is %d!\n", b);
printf("I also like %d.. but not as much as %d!\n", c, b);
return 0;
}
これは、makefileではなく、ソースコードでのみ「修正」できます。
このルールはC99で緩和されましたが、私の意見では、変数の定義、宣言、および初期化をその下のコードから分離することをお勧めします:)
したがって、makefileを変更してC99でコンパイルするには、makefileが参照している「build」ディレクトリのMakefileを変更し、ソースファイルをコンパイルする「gcc」行に「-std=c99」を追加する必要があります。