Closed chaseadam closed 11 years ago
It seems just removing the includes from hexbright/libraries/hb_utilities/print_binary.h did the job, but I don't quite understand why. It makes sense that those should be included, but maybe the arduino software just always appends those includes in a different way.
Arduino will only pull in its libraries if they are included in the .ino file itself, so that is part of it
Are you using an up-to-date version of the library? If so, which program were you trying to compile?
I pulled the latest git today: git clone https://github.com/dhiltonp/hexbright
Nearly all programs include print_binary, so I received that error for tactical and alarm_clock.
Looking at the examples, they don't explicitly include arduino libraries such as Serial.h, but do require it for "extra" libraries such as Wire. If I insert an include for Serial.h in any of my sketches, the compile fails. I have access to Serial even if I don't include Serial.h.
I'm guessing that you had a compiled version of print_binary, and the build system recognized that it was out of date. This is weird because print_binary is only pulled in by tests/accelerometer_test. I just did a fresh clone of the repo and didn't have any sort of issue.
Thanks for the report, let me know if anything else comes up.
This is probably due to my limited knowledge of working with Arduino libraries, but I don't understand how a compiled version would provide this behaviour. I am not sure where the compiled versions are even stored.
I did a fresh clone, changed my sketchbook directory to the cloned directory and attempted to build alarm_clock, but received the same error:
In file included from /tmp/hexbright/libraries/hb_utilities/print_binary.cpp:1:0: /tmp/hexbright/libraries/hb_utilities/print_binary.h:5:20: fatal error: Serial.h: No such file or directory
^
and with tactical:
In file included from /tmp/hexbright/libraries/hb_utilities/print_binary.cpp:1:0: /tmp/hexbright/libraries/hb_utilities/print_binary.h:5:20: fatal error: Serial.h: No such file or directory
^
compilation terminated.
[achasen@quad-PC ~]$ rpm -q arduino arduino-1.0.5-1.fc19.noarch
Full build: avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/tmp/hexbright/libraries/hb_utilities -I/tmp/hexbright/libraries/hexbright -I/tmp/hexbright/libraries/Time /tmp/build693953833166574624.tmp/alarm_clock.cpp -o /tmp/build693953833166574624.tmp/alarm_clock.cpp.o In file included from /tmp/hexbright/libraries/hb_utilities/print_power.h:4:0, from alarm_clock.ino:1: /tmp/hexbright/libraries/hexbright/hexbright.h:138:0: warning: "BIT_SET" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_power.h:4, from alarm_clock.ino:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:4:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hb_utilities/print_power.h:4:0, from alarm_clock.ino:1: /tmp/hexbright/libraries/hexbright/hexbright.h:139:0: warning: "BIT_CLEAR" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_power.h:4, from alarm_clock.ino:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:5:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:422:0, from alarm_clock.ino:7: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:4:0: warning: "BIT_SET" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hb_utilities/print_power.h:4:0, from alarm_clock.ino:1: /tmp/hexbright/libraries/hexbright/hexbright.h:138:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:422:0, from alarm_clock.ino:7: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:5:0: warning: "BIT_CLEAR" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hb_utilities/print_power.h:4:0, from alarm_clock.ino:1: /tmp/hexbright/libraries/hexbright/hexbright.h:139:0: note: this is the location of the previous definition
^ In file included from alarm_clock.ino:7:0: /tmp/hexbright/libraries/hexbright/hexbright.h: In static member function 'static void hexbright::set_light_level(long unsigned int)': /tmp/hexbright/libraries/hexbright/hexbright.h:669:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] } else if(level == OFF_LEVEL) { ^ In file included from alarm_clock.ino:7:0: /tmp/hexbright/libraries/hexbright/hexbright.h: In static member function 'static void hexbright::read_accelerometer()': /tmp/hexbright/libraries/hexbright/hexbright.h:960:10: warning: statement has no effect [-Wunused-value] for(i; i<4; i++) { ^ alarm_clock.ino: In function 'void loop()': alarm_clock.ino:48:52: warning: array subscript has type 'char' [-Wchar-subscripts] avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/tmp/hexbright/libraries/hb_utilities -I/tmp/hexbright/libraries/hexbright -I/tmp/hexbright/libraries/Time -I/tmp/hexbright/libraries/hb_utilities/utility /tmp/hexbright/libraries/hb_utilities/strobe.cpp -o /tmp/build693953833166574624.tmp/hb_utilities/strobe.cpp.o In file included from /tmp/hexbright/libraries/hb_utilities/strobe.h:4:0, from /tmp/hexbright/libraries/hb_utilities/strobe.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:138:0: warning: "BIT_SET" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/strobe.h:4, from /tmp/hexbright/libraries/hb_utilities/strobe.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:4:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hb_utilities/strobe.h:4:0, from /tmp/hexbright/libraries/hb_utilities/strobe.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:139:0: warning: "BIT_CLEAR" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/strobe.h:4, from /tmp/hexbright/libraries/hb_utilities/strobe.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:5:0: note: this is the location of the previous definition
^ avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/tmp/hexbright/libraries/hb_utilities -I/tmp/hexbright/libraries/hexbright -I/tmp/hexbright/libraries/Time -I/tmp/hexbright/libraries/hb_utilities/utility /tmp/hexbright/libraries/hb_utilities/print_power.cpp -o /tmp/build693953833166574624.tmp/hb_utilities/print_power.cpp.o In file included from /tmp/hexbright/libraries/hb_utilities/print_power.h:4:0, from /tmp/hexbright/libraries/hb_utilities/print_power.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:138:0: warning: "BIT_SET" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_power.h:4, from /tmp/hexbright/libraries/hb_utilities/print_power.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:4:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hb_utilities/print_power.h:4:0, from /tmp/hexbright/libraries/hb_utilities/print_power.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:139:0: warning: "BIT_CLEAR" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_power.h:4, from /tmp/hexbright/libraries/hb_utilities/print_power.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:5:0: note: this is the location of the previous definition
^ avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/tmp/hexbright/libraries/hb_utilities -I/tmp/hexbright/libraries/hexbright -I/tmp/hexbright/libraries/Time -I/tmp/hexbright/libraries/hb_utilities/utility /tmp/hexbright/libraries/hb_utilities/print_number.cpp -o /tmp/build693953833166574624.tmp/hb_utilities/print_number.cpp.o In file included from /tmp/hexbright/libraries/hb_utilities/print_number.h:4:0, from /tmp/hexbright/libraries/hb_utilities/print_number.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:138:0: warning: "BIT_SET" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_number.h:4, from /tmp/hexbright/libraries/hb_utilities/print_number.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:4:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hb_utilities/print_number.h:4:0, from /tmp/hexbright/libraries/hb_utilities/print_number.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:139:0: warning: "BIT_CLEAR" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_number.h:4, from /tmp/hexbright/libraries/hb_utilities/print_number.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:5:0: note: this is the location of the previous definition
^ avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/tmp/hexbright/libraries/hb_utilities -I/tmp/hexbright/libraries/hexbright -I/tmp/hexbright/libraries/Time -I/tmp/hexbright/libraries/hb_utilities/utility /tmp/hexbright/libraries/hb_utilities/print_binary.cpp -o /tmp/build693953833166574624.tmp/hb_utilities/print_binary.cpp.o In file included from /tmp/hexbright/libraries/hb_utilities/print_binary.h:4:0, from /tmp/hexbright/libraries/hb_utilities/print_binary.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:138:0: warning: "BIT_SET" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_binary.h:4, from /tmp/hexbright/libraries/hb_utilities/print_binary.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:4:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hb_utilities/print_binary.h:4:0, from /tmp/hexbright/libraries/hb_utilities/print_binary.cpp:1: /tmp/hexbright/libraries/hexbright/hexbright.h:139:0: warning: "BIT_CLEAR" redefined [enabled by default]
^ In file included from /tmp/hexbright/libraries/hexbright/hexbright.h:36:0, from /tmp/hexbright/libraries/hb_utilities/print_binary.h:4, from /tmp/hexbright/libraries/hb_utilities/print_binary.cpp:1: /tmp/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:5:0: note: this is the location of the previous definition
^ In file included from /tmp/hexbright/libraries/hb_utilities/print_binary.cpp:1:0: /tmp/hexbright/libraries/hb_utilities/print_binary.h:5:20: fatal error: Serial.h: No such file or directory
^
Chaseadam (whom I almost certainly worked with at rPath), Serial.h doesn't exist in my tree either (tarball on an Ubuntu system). Two minutes of grep-fu didn't give me any answers but I can compile everything fine. I know that Arduino does some funky things in the build process and probably creates Serial.h on they fly. My guess is that the Fedora arduino package is just broken. I suggest that you download the tarball and try.
Oh, and try programs/up_n_down. It's my baby.
--Whitney.
Did you restart Arduino after pointing it to the new directory?
I did restart Arduino software between these efforts.
Hello there Whitney! I will be sure to try out up_n_down.
I tried with the 1.0.5 download as well but received the same error. I will install an Ubuntu VM and see if I can reproduce the behaviour.
Ah ha!
I get this when I build alarm_clock:
/home/whitney/arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/home/whitney/arduino-1.0.5/hardware/arduino/cores/arduino -I/home/whitney/arduino-1.0.5/hardware/arduino/variants/standard -I/home/whitney/git/hexbright/libraries/hb_utilities -I/home/whitney/git/hexbright/libraries/hexbright -I/home/whitney/git/hexbright/libraries/Time -I/home/whitney/git/hexbright/libraries/hb_utilities/utility /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.cpp -o /tmp/build5774596037140215150.tmp/hb_utilities/print_binary.cpp.o In file included from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.h:4, from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.cpp:1: /home/whitney/git/hexbright/libraries/hexbright/hexbright.h:138:1: warning: "BIT_SET" redefined In file included from /home/whitney/git/hexbright/libraries/hexbright/hexbright.h:36, from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.h:4, from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.cpp:1: /home/whitney/git/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:4:1: warning: this is the location of the previous definition In file included from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.h:4, from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.cpp:1: /home/whitney/git/hexbright/libraries/hexbright/hexbright.h:139:1: warning: "BIT_CLEAR" redefined In file included from /home/whitney/git/hexbright/libraries/hexbright/hexbright.h:36, from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.h:4, from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.cpp:1: /home/whitney/git/hexbright/libraries/hexbright/../digitalWriteFast/digitalWriteFast.h:5:1: warning: this is the location of the previous definition In file included from /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.cpp:1: /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.h:5:20: warning: Serial.h: No such file or directory /home/whitney/git/hexbright/libraries/hb_utilities/print_binary.h:6:20: warning: String.h: No such file or directory
Note the warnings. These are errors for you.
David, it seems that Serial.h and String.h aren't needed. We should remove them. I'm currently moving and don't have internet in the house...Not it! Also, we have some silly compile warnings that should be cleaned up. I'll do that during a meeting sometime. Adam, you can safely remove the offending lines and all should be well.
--W.
I've just put in the fix; sorry about the delay.
It has the unfortunate side-effect of not raising a warning when print_binary() is used without including String.h and Serial.h in the .ino file, but c'est la vie.
I am using arduino 1.0.5 installed from Fedora 19 repos. I can see that Serial.h exists in ardunio trunk http://code.google.com/p/arduino/source/browse/trunk/targets/?r=132#targets%2Farduino, but for some reason I don't see it anywhere installed. I also downloaded the arduino software tarballs and didn't see Serial.h in there.
Any assistance to resolving the missing Serial.h is appreciated.
In file included from /home/achasen/sketchbook/hexbright/libraries/hb_utilities/print_binary.cpp:1:0: /home/achasen/sketchbook/hexbright/libraries/hb_utilities/print_binary.h:5:20: fatal error: Serial.h: No such file or directory
Thanks!