I have a feeling I may be doing or understanding something wrong, but I was very surprised to see libraries such as IPAddress get included into a sketch I'm working on. The includes in my sketch are:
// Low power stuff
include
// Servo motor stuff
include
// RTC stuff
include
include
include
But when I build I get a heck of a lot more:
JeeLib/Ports.cpp
Linking libJeeLib.a
RTClib/RTClib.cpp
Linking libRTClib.a
TimeAlarms/TimeAlarms.cpp
Linking libTimeAlarms.a
Servo/Servo.cpp
Linking libServo.a
Wire/utility/twi.c
Wire/Wire.cpp
Linking libWire.a
Time/Time.cpp
Linking libTime.a
arduino/wiring_analog.c
arduino/wiring_digital.c
arduino/wiring_pulse.c
arduino/avr-libc/realloc.c
arduino/avr-libc/malloc.c
arduino/wiring_shift.c
arduino/WInterrupts.c
arduino/wiring.c
/usr/share/arduino/hardware/arduino/cores/arduino/wiring.c: In function ‘init’:
/usr/share/arduino/hardware/arduino/cores/arduino/wiring.c:264:3: warning: #warning Timer 2 not finished (may not be present on this CPU) [-Wcpp]
/usr/share/arduino/hardware/arduino/cores/arduino/wiring.c:273:3: warning: #warning Timer 2 not finished (may not be present on this CPU) [-Wcpp]
arduino/CDC.cpp
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Platform.h:9:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/CDC.cpp:19:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
arduino/HardwareSerial.cpp
arduino/Stream.cpp
arduino/WMath.cpp
arduino/Print.cpp
arduino/HID.cpp
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Platform.h:9:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HID.cpp:19:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
arduino/Tone.cpp
/usr/share/arduino/hardware/arduino/cores/arduino/Tone.cpp:210:12: warning: #warning this may not be correct [-Wcpp]
arduino/WString.cpp
arduino/new.cpp
arduino/USBCore.cpp
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Platform.h:9:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/USBCore.cpp:19:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
arduino/main.cpp
arduino/IPAddress.cpp
Linking libarduino.a
Linking firmware.elf
Converting to firmware.hex
Obviously some of these are indirect includes (eg, Wire.cpp). But I really doubt I'm actually dependent on Tone.cpp, IPAddress.cpp, and probably others.
In fact, I just tried moving IPAddress.cpp/h away, and they are no longer compiled. Interestingly, the size of firmware didn't change - so this bug is perhaps not as serious.
I have a feeling I may be doing or understanding something wrong, but I was very surprised to see libraries such as IPAddress get included into a sketch I'm working on. The includes in my sketch are: // Low power stuff
include
// Servo motor stuff
include
// RTC stuff
include
include
include
But when I build I get a heck of a lot more: JeeLib/Ports.cpp Linking libJeeLib.a RTClib/RTClib.cpp Linking libRTClib.a TimeAlarms/TimeAlarms.cpp Linking libTimeAlarms.a Servo/Servo.cpp Linking libServo.a Wire/utility/twi.c Wire/Wire.cpp Linking libWire.a Time/Time.cpp Linking libTime.a arduino/wiring_analog.c arduino/wiring_digital.c arduino/wiring_pulse.c arduino/avr-libc/realloc.c arduino/avr-libc/malloc.c arduino/wiring_shift.c arduino/WInterrupts.c arduino/wiring.c /usr/share/arduino/hardware/arduino/cores/arduino/wiring.c: In function ‘init’: /usr/share/arduino/hardware/arduino/cores/arduino/wiring.c:264:3: warning: #warning Timer 2 not finished (may not be present on this CPU) [-Wcpp] /usr/share/arduino/hardware/arduino/cores/arduino/wiring.c:273:3: warning: #warning Timer 2 not finished (may not be present on this CPU) [-Wcpp] arduino/CDC.cpp In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Platform.h:9:0, from /usr/share/arduino/hardware/arduino/cores/arduino/CDC.cpp:19: /usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp] arduino/HardwareSerial.cpp arduino/Stream.cpp arduino/WMath.cpp arduino/Print.cpp arduino/HID.cpp In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Platform.h:9:0, from /usr/share/arduino/hardware/arduino/cores/arduino/HID.cpp:19: /usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp] arduino/Tone.cpp /usr/share/arduino/hardware/arduino/cores/arduino/Tone.cpp:210:12: warning: #warning this may not be correct [-Wcpp] arduino/WString.cpp arduino/new.cpp arduino/USBCore.cpp In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Platform.h:9:0, from /usr/share/arduino/hardware/arduino/cores/arduino/USBCore.cpp:19: /usr/lib/gcc/avr/4.7.2/../../../avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp] arduino/main.cpp arduino/IPAddress.cpp Linking libarduino.a Linking firmware.elf Converting to firmware.hex
Obviously some of these are indirect includes (eg, Wire.cpp). But I really doubt I'm actually dependent on Tone.cpp, IPAddress.cpp, and probably others.