Ok now I’m seeing some really bizarre issue as well. I have this test2.ino app that I like to just throw stuff in and compile from time to time. I’m PRETTY sure I never had liquid-crystal-spi
in there, ever. Here’s my code:
#if defined (SPARK)
// Define the pins we're going to call pinMode on
int led = D0; // You'll need to wire an LED to this one to see it blink.
int led2 = D7; // This one is the built-in tiny one to the right of the USB jack
#endif
// This routine runs only once upon reset
void setup() {
// Initialize D0 + D7 pin as output
// It's important you do this here, inside the setup() function rather than outside it or in the loop function.
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
}
// This routine gets called repeatedly, like once every 5-15 milliseconds.
// Spark firmware interleaves background CPU activity associated with WiFi + Cloud activity with your code.
// Make sure none of your code delays or blocks for too long (like more than 5 seconds), or weird things can happen.
void loop() {
digitalWrite(led, HIGH); // Turn ON the LED pins
digitalWrite(led2, HIGH);
delay(1000); // Wait for 1000mS = 1 second
digitalWrite(led, LOW); // Turn OFF the LED pins
digitalWrite(led2, LOW);
delay(1000); // Wait for 1 second in off mode
}
And here’s the error… check out the weirdness.
In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:29,
from /liquid-crystal-spi/liquid-crystal-spi.h:17,
from /liquid-crystal-spi/liquid-crystal-spi.cpp:33:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
#warning "Defaulting to Release Build"
^
In file included from ../inc/spark_wiring.h:37:0,
from ../inc/application.h:29,
from /liquid-crystal-spi/liquid-crystal-spi.h:17,
from /liquid-crystal-spi/liquid-crystal-spi.cpp:33:
../inc/spark_wiring_ipaddress.h: In member function 'IPAddress::operator uint32_t()':
../inc/spark_wiring_ipaddress.h:53:52: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
operator uint32_t() { return *((uint32_t*)_address); };
^
../inc/spark_wiring_ipaddress.h: In member function 'bool IPAddress::operator==(const IPAddress&)':
../inc/spark_wiring_ipaddress.h:54:72: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); };
^
../inc/spark_wiring_ipaddress.h:54:105: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); };
^
/test2.cpp: In function 'void setup()':
/test2.cpp:16:11: error: 'led' was not declared in this scope
pinMode(led, OUTPUT);
^
/test2.cpp:16:16: error: 'OUTPUT' was not declared in this scope
pinMode(led, OUTPUT);
^
/test2.cpp:16:22: error: 'pinMode' was not declared in this scope
pinMode(led, OUTPUT);
^
/test2.cpp:17:11: error: 'led2' was not declared in this scope
pinMode(led2, OUTPUT);
^
/test2.cpp: In function 'void loop()':
/test2.cpp:24:16: error: 'led' was not declared in this scope
digitalWrite(led, HIGH); // Turn ON the LED pins
^
/test2.cpp:24:21: error: 'HIGH' was not declared in this scope
digitalWrite(led, HIGH); // Turn ON the LED pins
^
/test2.cpp:24:25: error: 'digitalWrite' was not declared in this scope
digitalWrite(led, HIGH); // Turn ON the LED pins
^
/test2.cpp:25:16: error: 'led2' was not declared in this scope
digitalWrite(led2, HIGH);
^
/test2.cpp:26:13: error: 'delay' was not declared in this scope
delay(1000); // Wait for 1000mS = 1 second
^
/test2.cpp:27:21: error: 'LOW' was not declared in this scope
digitalWrite(led, LOW); // Turn OFF the LED pins
^
make: *** [/test2.o] Error 1
If you comment out the #if defined (SPARK)
and #endif
it compiles fine.
The web IDE won’t complain if you just add this code to a blank sketch if you don’t also use the led and led2 variables:
#if defined (SPARK)
// Define the pins we're going to call pinMode on
int led = D0; // You'll need to wire an LED to this one to see it blink.
int led2 = D7; // This one is the built-in tiny one to the right of the USB jack
#endif
As a side note, I’m seeing this warning now in local build and web IDE
../inc/spark_wiring_ipaddress.h: In member function 'IPAddress::operator uint32_t()':
../inc/spark_wiring_ipaddress.h:53:52: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
operator uint32_t() { return *((uint32_t*)_address); };
^
../inc/spark_wiring_ipaddress.h: In member function 'bool IPAddress::operator==(const IPAddress&)':
../inc/spark_wiring_ipaddress.h:54:72: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); };
^
../inc/spark_wiring_ipaddress.h:54:105: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); };
From this recent change: https://github.com/spark/core-firmware/pull/219/files Issue?