2011-03-19 72 views
1

我編譯在命令行中使用AVR-GCC編譯用make在OSX

之一包括我使用的有下面幾行:

#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 

當我運行使我得到:

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

第86行是#if F_CPU != 16000000以上。我不確定爲什麼我會收到錯誤。可以生產

回答

1

這種消息,例如用於以下編譯:

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

注意F_CPU被定義,但並不是任何東西=使用!。

+0

我錯過了在我的make文件中發佈的事實,F_CPU事實上被定義爲什麼都沒有。 – Justin808 2011-03-20 01:21:38