2012-01-12 65 views
3

控制檯輸出是:Eclipse的正確編譯,但顯示在「問題」視圖錯誤

**** Build of configuration Release for project Timertestnew **** 

make all 
Building file: ../main.cpp 
Invoking: AVR C++ Compiler 
avr-g++ -I"G:\arduino-1.0\hardware\arduino\cores\arduino" -DARDUINO=100 -Wall -Os -fpack-struct -fshort-enums -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF"main.d" -MT"main.d" -c -o "main.o" "../main.cpp" 
Finished building: ../main.cpp 

Building target: Timertestnew.elf 
Invoking: AVR C++ Linker 
avr-gcc --cref -s -Os -o"Timertestnew.elf" ./main.o -lArduinoCore -lm -Wl,-Map,Timertestnew.map,--cref -L"C:\Users\Akhil\workspace\Timertestnew" -mmcu=atmega328p 
Finished building target: Timertestnew.elf 

Create Flash image (ihex format) 
avr-objcopy -R .eeprom -O ihex Timertestnew.elf "Timertestnew.hex" 
Finished building: Timertestnew.hex 

Invoking: Print Size 
avr-size --format=avr --mcu=atmega328p Timertestnew.elf 
AVR Memory Usage 
---------------- 
Device: atmega328p 

Program:  620 bytes (1.9% Full) 
(.text + .data + .bootloader) 

Data:   9 bytes (0.4% Full) 
(.data + .bss + .noinit) 


Finished building: sizedummy 


**** Build Finished **** 

「問題」視圖輸出是:

Description Resource Path Location Type 
Symbol 'EEARH' could not be resolved main.cpp /Timertestnew line 15 Semantic Error 

是否有可能的Eclipse IDE誤表示這個錯誤,而編譯它很好? 我該如何解決這個問題?

回答

2

嘗試從問題視圖中刪除問題標記並重建項目(完全不只是增量)。如果解決了這個問題,那麼它只是編譯器的不一致狀態。但是,如果它不能解決問題,那麼Eclipse編輯器可能會使用不同的解析器(用於內容輔助等),它不能處理編譯器可以處理的內容。對於這種情況,我會查看與錯誤相關的C/C++編輯器首選項,也許它可以關閉(但是,我不編程C/C++,所以我不能告訴你要查找什麼)。

2

avr-gcc編譯器使用其-mmcu命令行參數來確定要包含哪個IO頭文件(因此符號寄存器定義包括報告的EEARH EEPROM高地址寄存器)。 Documentation here。 Eclipse可能不知道這個'後門'預處理器符號定義(因爲它可能使用不同的編譯器進行問題檢測)。在控制檯輸出中,它看起來像是您需要的IO頭文件:avr/iom328p.h當定義了__AVR_ATmega328P__預處理器符號(see here)時包含此文件。如果您將此符號提供給Eclipse,它應該使其編譯器選取正確的文件並定義相關的寄存器。

相關問題