2012-01-12 89 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,它应该使其编译器选取正确的文件并定义相关的寄存器。

相关问题