1

avr-gcc を使用してコマンドラインでコンパイルしています

私が使用しているインクルードの 1 つには、次の行があります。

#ifndef F_CPU
#warning No CPU speed specified - assuming Axon is running at 16MHz
#define F_CPU 16000000
#endif

#if F_CPU != 16000000
#warning "AxonII normally runs at 16MHz but you have defined a different value"
#endif

make を実行すると、次のようになります。

In file included from main.c:7:
../webbotavrclib/sys/axon2.h:86:11: error: operator '!=' has no left operand

86行目は#if F_CPU != 16000000上です。なぜエラーが発生するのかわかりません。

4

1 に答える 1

1

このようなメッセージは、たとえば、次のコンパイルで生成される可能性があります。

$ gcc main.c -DF_CPU=
  main.c:6:11: error: operator '!=' has no left operand

F_CPU は定義されていますが、!= が使用するものではないことに注意してください。

于 2011-03-20T01:08:59.427 に答える