Code 'suddenly' won't verify

Hi,

First code problem post, I’m stumped. Sorry if I’m providing the information in the wrong way!
I’m getting an odd error when I verify my code. I made some changes and now it won’t verify. I went back to a backup copy that did verify, and that won’t either! What’s weird is this code used to work! If I’ve messed something up then I just can’t see what it is. Can anyone help?

It seems to be complaining about the start of the file, which looks like this:

// This #include statement was automatically added by the Particle IDE.
#include "RelayShield/RelayShield.h"

#include "application.h"

// Create an instance of the RelayShield library, so we have something to talk to
RelayShield myRelays;

To me, the log seems to be referring to the library file, which is crazy! So I’m obviously misreading the situation.

The verification log is:

32+0 records in
32+0 records out
32 bytes (32 B) copied, 7.3701e-05 s, 434 kB/s
4+0 records in
4+0 records out
4 bytes (4 B) copied, 0.0433473 s, 0.1 kB/s
In file included from garagedoor.cpp:2:0:
RelayShield/RelayShield.h:26:8: warning: extra tokens at end of #endif directive [enabled by default]
 #endif RelayShield_h
        ^
In file included from RelayShield/RelayShield.cpp:1:0:
RelayShield/RelayShield.h:26:8: warning: extra tokens at end of #endif directive [enabled by default]
 #endif RelayShield_h
        ^
/tmp/ccjyUEdU.ltrans0.ltrans.o: In function `Timer::invoke_timer(void*) [clone .local.406]':
/spark/compile_service/shared/workspace/0_core_0.6.0_102_1/firmware/main/../wiring/inc/spark_wiring_timer.h:119: undefined reference to `os_timer_get_id'
/tmp/ccjyUEdU.ltrans7.ltrans.o: In function `_stop':
/spark/compile_service/shared/workspace/0_core_0.6.0_102_1/firmware/main/../wiring/inc/spark_wiring_timer.h:71: undefined reference to `os_timer_change'
/tmp/ccjyUEdU.ltrans7.ltrans.o: In function `_reset':
/spark/compile_service/shared/workspace/0_core_0.6.0_102_1/firmware/main/../wiring/inc/spark_wiring_timer.h:76: undefined reference to `os_timer_change'
/tmp/ccjyUEdU.ltrans8.ltrans.o: In function `isActive':
/spark/compile_service/shared/workspace/0_core_0.6.0_102_1/firmware/main/../wiring/inc/spark_wiring_timer.h:61: undefined reference to `os_timer_is_active'
/spark/compile_service/shared/workspace/0_core_0.6.0_102_1/firmware/main/../wiring/inc/spark_wiring_timer.h:61: undefined reference to `os_timer_is_active'
/tmp/ccjyUEdU.ltrans18.ltrans.o: In function `dispose':
/spark/compile_service/shared/workspace/0_core_0.6.0_102_1/firmware/main/../wiring/inc/spark_wiring_timer.h:92: undefined reference to `os_timer_destroy'
/tmp/ccjyUEdU.ltrans23.ltrans.o: In function `__base_ctor ':
/spark/compile_service/shared/workspace/0_core_0.6.0_102_1/firmware/main/../wiring/inc/spark_wiring_timer.h:34: undefined reference to `os_timer_create'
collect2: error: ld returned 1 exit status
make[1]: *** [22fd80747f8449855b985497ea01cf2f6b0fa2d7fe1c902b3329465e3523.elf] Error 1
make: *** [main] Error 2

Could you always state the device and firmware version you intend to be building for?

Because the error messages suggest you are building for Spark Core 0.6.0 (default) - is this intended?

Software Timers don’t exist on Spark Core (unless included via a dedicated library)

I’m having same problem…

Dev stays in a loop toggling between “success” and “compiling in the cloud…”

Hi @ScruffR,
Sorry, will do! The devices pop-over says the Photon is running 0.6.0 so, while I won’t go so far as to say ‘intended’, yes, that looks right. :smile: I’ve just gone with the defaults since I don’t have enough experience with this hardware to do anything other!
The only libraries imported are application.h and RelayShield.h. I don’t know what to say about the timers other than they were doing a good impression of working! But, even if they don’t actually work, this code still used to compile and now it doesn’t so I’m thinking that the timers aren’t the cause, unless there’s been some external change that’s now flagging them. But, even if that were true, it seems odd that the verification should complain about the RelayShield.cpp file. Unless I’m reading the output wrong?

When you say you’ve got a Photon, but your error messages state you were building for Core, double check if you’ve actually got a golden star next to your Photon in the target drawer of Build.

Could you provide a screenshot of your IDE with the target selection view open?

Hi @ScruffR, that was the problem! The target Photon didn’t have a golden star next to it. I’ve clicked the star and recompiled the code and it works.

Thanks for your help!

1 Like

Are you sure? :wink: