In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:31,
from mytinker.cpp:2:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
obj/src/application.o: In function `tinkerAnalogWrite(String)':
/spark/compile_server/shared/workspace/worker_2/core-firmware/build/../inc/spark_wiring_ipaddress.h:48: multiple definition of `tinkerAnalogWrite(String)'
mytinker.o:/spark/compile_server/shared/workspace/worker_2/core-firmware/build/mytinker.cpp:161: first defined here
obj/src/application.o: In function `tinkerAnalogRead(String)':
/spark/compile_server/shared/workspace/worker_2/core-firmware/build/../src/application.cpp:126: multiple definition of `tinkerAnalogRead(String)'
mytinker.o:/spark/compile_server/shared/workspace/worker_2/core-firmware/build/mytinker.cpp:130: first defined here
obj/src/application.o: In function `tinkerDigitalWrite(String)':
/spark/compile_server/shared/workspace/worker_2/core-firmware/build/../src/application.cpp:91: multiple definition of `tinkerDigitalWrite(String)'
mytinker.o:/spark/compile_server/shared/workspace/worker_2/core-firmware/build/mytinker.cpp:87: first defined here
obj/src/application.o: In function `tinkerDigitalRead(String)':
/spark/compile_server/shared/workspace/worker_2/core-firmware/build/../src/application.cpp:64: multiple definition of `tinkerDigitalRead(String)'
mytinker.o:/spark/compile_server/shared/workspace/worker_2/core-firmware/build/mytinker.cpp:52: first defined here
collect2: error: ld returned 1 exit status
make: *** [a432cd145731d4152ace899630b7f7daa219011848d236dc2c1d0c35d1df.elf] Error 1
Edit: Sure I could - and have done - rename the tinkerXXX functions to avoid interference with existing functions in application.cpp, but this was not required before.
Why is it now? Was this intended or has this behaviour just crept in unintentionally?
But I can’t even see reason for doing so, since I’m not actualy writing a .cpp. The one and only “file” I’m working on for this simple sketch is an .ino which I thought will go through preprocessing that will add - or atleast did add previously - all the required blurb to make it work (the .cpp file mentioned in the error output must be created from my .ino by your preprocessor).
And even when I add #include “application.h” my sketch does not build. Then I get even stranger results like
In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:31,
from dmytest.cpp:8:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
dmytest.cpp:10:23: error: 'String' was not declared in this scope
dmytest.cpp:11:24: error: 'String' was not declared in this scope
dmytest.cpp:12:22: error: 'String' was not declared in this scope
dmytest.cpp:13:23: error: 'String' was not declared in this scope
dmytest.cpp:8:6: error: previous declaration of 'void setup()' with 'C++' linkage
In file included from ../inc/spark_wiring.h:34:0,
from ../inc/application.h:31,
from dmytest.cpp:8:
../inc/spark_utilities.h:120:35: error: conflicts with new declaration with 'C' linkage
dmytest.cpp:9:6: error: previous declaration of 'void loop()' with 'C++' linkage
In file included from ../inc/spark_wiring.h:34:0,
from ../inc/application.h:31,
from dmytest.cpp:8:
../inc/spark_utilities.h:121:34: error: conflicts with new declaration with 'C' linkage
dmytest.cpp: In function 'void setup()':
dmytest.cpp:30:52: error: invalid conversion from 'int' to 'int (*)(String)' [-fpermissive]
In file included from ../inc/spark_wiring.h:34:0,
...h
Could it be that now there is an overridable/override directive missing for the predefined application.cpp functions (e.g. tinkerAnalogWrite), which was there before?
Hmmm… Diving deeper into this, Okay, yes, you’re right. I’m not sure what changed recently, but the way user code is mixed with the firmware for builds hasn’t changed, so I’m not sure why this worked before on the build IDE and not now.
@Dave, could it actually be, that application.cpp gets linked in now, where it wasn’t before?
Since any user FW would completely replace Tinker on the Core anyhow, there is absolutely no need to put any code from the original application.cpp into the user generated binary - or am I wrong?
Ahh, yes. Someone updated the compile-server2 branch, which previously had the application.cpp file zeroed out. Thank you for catching this, I’ll fix that when I get a chance.
Any news on this? I’m stuck with the same errors however my errors don’t change wether I include or not “application.h” and can’t compile.
I updated all libs from Github and compiled locally and nothing. It looks like it has something to do with the includes in wiring.cpp but they haven’t changed since long.
Cheers
In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:31,
from readxml.cpp:26:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
/opt/gcc_arm/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'
/opt/gcc_arm/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x10): undefined reference to `_write'
/opt/gcc_arm/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
/opt/gcc_arm/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
/opt/gcc_arm/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'
/opt/gcc_arm/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'
collect2: error: ld returned 1 exit status
make: *** [c64ce096332c164074560b17e73226e3c731ed1f5d24b4f7cd429c2c2ac2.elf] Error 1
Error: Could not compile. Please review your code.
Victor, I just copied the code from your link into a web IDE app I called “crap” , edited out the #include “string.h” line and hit verify… Code verified! Great work.
well, thank you peekay and bko
I still don’t know what the problem was though. Locally, I even deleted and pulled the three libs with the osx Github app and in the web IDE it’s still not working. However, doing the git reset and pull got it working on Eclipse.
It’s a bit late here, I’ll test it tomorrow and see if it does what it’s intended to do.
Cheers!
PS: I got it. The code I posted was not exactly the code I was using. I omitted some debugging lines I had around on which I was using printf() (I coded it for c++ and then adapted to arduino) and the compiler doesn’t seem to like it