Compiler Errors

I'm using Xcode 3.1.2 on Mac OS 10.5.7 with scripts to compile my code which worked for some blinky type apps:

/sw/bin/avr-gcc -c -g -Wall -mmcu=atmega168 -I. ${INPUT_FILE_PATH} -o build/${INPUT_FILE_BASE}.o

/sw/bin/avr-gcc build/main.o -mmcu=atmega168 -o build/aser.elf

/sw/bin/avr-objcopy -O ihex build/aser.elf build/aser.rom

I've incorporated the LCD4Bit.cpp file along with several supporting files to get a demo together with an LCD. I have 2 errors that seem strange to me, I'm a few years out of practice on C/C++:

Error #1:

in stdlib.h: extern int abs(int i) __ATTR_CONST;

error: unexpected unqualified-id before 'int'

I know abs is a built-in in GCC - I don't have it excluded with a cmd line option. I recall from past C/C++ work that there were a couple of things that I ran into that would cause errors in the standard C libs.

Error #2:


const uint16_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, NOT_A_PORT, &DDRB, &DDRC, &DDRD, };

error: invalid conversion from 'volatile uint8_t*' to 'uint16_t' - There are actually 6 of these errors reported at the end of that statement.

Here are some lines from various header files, I've used warning statements to track that I am in fact hitting each of these points during the build. As far as I can tell I should in fact get the error it's spitting out. I don't know why other people aren't reporting it.

From pins_arduino.h

define NOT_A_PORT 0

From iomx8.h:

define DDRD _SFR_IO8 (0x0A)

From sfr_defs.h:

define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr) + 0x20)

define _MMIO_BYTE(mem_addr) (*(volatile uint8_t *)(mem_addr))

From stdint.h - I am still working through WTH this does/means: typedef unsigned int uint8_t attribute((mode(QI)));

Thanks for any help/suggestions.

Search the forums for the error message error: unexpected unqualified-id before 'int' and you should find an answer–assuming the cause is the same as the IDE.


Thanks for the reply. I did a search and a google on that phrase and some sub-portions of it with no luck.

I just got back to this issue in my project and am troubleshooting it. I'm not used to all the preprocessor coding in these embedded systems so it's giving me heck.