I've been working on compiling Arduino sketches without using the IDE. With the generous help of people here, I've gotten in to work. But, I've run into one strange problem that's driving me nuts. I get errors from a library that I have been using for some time. Additionally, the sketch compiles just fine with the Arduino IDE.
Here is the list of errors I get when trying a CLI compile:
In file included from /usr/share/arduino-1.0.2/libraries/Flash/Flash.cpp:21:0:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:68:22: error: ‘prog_char’ does not name a type
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:68:33: error: ISO C++ forbids declaration of ‘arr’ with no type [-fpermissive]
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:78:8: error: ‘prog_char’ does not name a type
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:90:8: error: ‘prog_char’ does not name a type
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h: In member function ‘size_t _FLASH_STRING::length() const’:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:71:20: error: ‘_arr’ was not declared in this scope
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h: In member function ‘char* _FLASH_STRING::copy(char*, size_t, size_t) const’:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:74:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:75:23: error: ‘_arr’ was not declared in this scope
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h: In member function ‘char _FLASH_STRING::operator[](int) const’:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:85:29: error: ‘_arr’ was not declared in this scope
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h: At global scope:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:179:28: error: ‘prog_char’ does not name a type
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:179:40: error: ISO C++ forbids declaration of ‘arr’ with no type [-fpermissive]
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:197:8: error: ‘prog_char’ does not name a type
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h: In constructor ‘_FLASH_STRING_ARRAY::_FLASH_STRING_ARRAY(const int**, size_t)’:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:179:61: error: class ‘_FLASH_STRING_ARRAY’ does not have any field named ‘_arr’
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h: In member function ‘_FLASH_STRING _FLASH_STRING_ARRAY::operator[](int) const’:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:186:25: error: ‘_arr’ was not declared in this scope
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h: In member function ‘virtual void _FLASH_STRING_ARRAY::print(Print&) const’:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.h:190:22: error: ‘_arr’ was not declared in this scope
/usr/share/arduino-1.0.2/libraries/Flash/Flash.cpp: At global scope:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.cpp:23:36: error: ‘prog_char’ does not name a type
/usr/share/arduino-1.0.2/libraries/Flash/Flash.cpp:23:47: error: ISO C++ forbids declaration of ‘arr’ with no type [-fpermissive]
/usr/share/arduino-1.0.2/libraries/Flash/Flash.cpp: In constructor ‘_FLASH_STRING::_FLASH_STRING(const int*)’:
/usr/share/arduino-1.0.2/libraries/Flash/Flash.cpp:23:54: error: class ‘_FLASH_STRING’ does not have any field named ‘_arr’
make: *** [.lib/usr/share/arduino-1.0.2/libraries/Flash/Flash.cpp.o] Error 1
To avoid cluttering up the post, I'll refrain from posting other files until I have some idea WHICH ones to post (i.e. I am totally clueless as to what the error is).
I tried to Google the error messages and found references to changes in "Print.h", but these are old patches and have long since been incorporated into the current code.
PaulS:
The prog_char declaration is in avr/pgmspace.h. Are you including this header file? Is the compiler able to find it?
The pgmspace header is in the .ino file itself and in the Flash library header.
I assume the compiler can find it because there are lots of other libraries I have included in the particular program I'm trying to compile and they are all being found.
I assume the compiler can find it because there are lots of other libraries I have included in the particular program I'm trying to compile and they are all being found.
I assume the compiler can find it because there are lots of other libraries I have included in the particular program I'm trying to compile and they are all being found.
Perhaps we could have a peek at your makefile?
Just found something strange...... there are TWO avr-gcc toolsets on my machine. One is from the Arduino install, the other I have no idea where it came from (it's in /usr/bin/avr).
Anyway, I "removed" the non-Arduino toolset by renaming /usr/bin/avr to usr/bin/_avr (note the underscore) and NOW it all works!