# \[SOLVED\] Compile problem with Timer?

**URL:** <https://community.particle.io/t/solved-compile-problem-with-timer/20426>\
**Category:** Firmware\
**Created:** [February 24, 2016, 5:40pm UTC](https://community.particle.io/t/solved-compile-problem-with-timer/20426 "2016-02-24T17:40:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgrecojr](https://avatars.discourse-cdn.com/v4/letter/t/ed655f/32.png) [@tgrecojr](https://community.particle.io/u/tgrecojr)\
**Post date:** [February 24, 2016, 5:40pm UTC](https://community.particle.io/t/solved-compile-problem-with-timer/20426/1 "2016-02-24T17:40:22Z")

</div>

All of a sudden, I am having problems with the Software Timers. The following code:

```cpp
Timer timer(2000, doStuff);

void setup() {
    timer.start();
}

void loop() {

}

void doStuff(){
    //stuff goes here
}

```

Produces these errors:

```nohighlight
/tmp/cc7wNzBN.ltrans0.ltrans.o: In function `invoke_timer':
/mnt/compile-service-shared-workspace/0_core__24_1/firmware/main/../wiring/inc/spark_wiring_timer.h:118: undefined reference to `os_timer_get_id'
/tmp/cc7wNzBN.ltrans0.ltrans.o: In function `__base_ctor ':
/mnt/compile-service-shared-workspace/0_core__24_1/firmware/main/../wiring/inc/spark_wiring_timer.h:34: undefined reference to `os_timer_create'
/tmp/cc7wNzBN.ltrans20.ltrans.o: In function `_stop':
/mnt/compile-service-shared-workspace/0_core__24_1/firmware/main/../wiring/inc/spark_wiring_timer.h:70: undefined reference to `os_timer_change'
/tmp/cc7wNzBN.ltrans20.ltrans.o: In function `dispose':
/mnt/compile-service-shared-workspace/0_core__24_1/firmware/main/../wiring/inc/spark_wiring_timer.h:91: undefined reference to `os_timer_destroy'
collect2: error: ld returned 1 exit status
make[1]: *** [fa5725fab7a94fbb1ecc19d9ce447af663914dd693ad4563958d53e0a9c9.elf] Error 1
make: *** [main] Error 2

```

What is going on?

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 24, 2016, 6:17pm UTC](https://community.particle.io/t/solved-compile-problem-with-timer/20426/2 "2016-02-24T18:17:28Z")

</div>

I guess you are targeting a Core instead of a Photon/P1/Electron

---

<div class="post-metadata">

**Author:** ![tgrecojr](https://avatars.discourse-cdn.com/v4/letter/t/ed655f/32.png) [@tgrecojr](https://community.particle.io/u/tgrecojr)\
**Post date:** [February 24, 2016, 6:24pm UTC](https://community.particle.io/t/solved-compile-problem-with-timer/20426/3 "2016-02-24T18:24:31Z")

</div>

Nope, I have a Photon!

---

<div class="post-metadata">

**Author:** ![tgrecojr](https://avatars.discourse-cdn.com/v4/letter/t/ed655f/32.png) [@tgrecojr](https://community.particle.io/u/tgrecojr)\
**Post date:** [February 24, 2016, 6:38pm UTC](https://community.particle.io/t/solved-compile-problem-with-timer/20426/4 "2016-02-24T18:38:23Z")

</div>

And now… without changing a thing… it compiles! So weird.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 24, 2016, 6:42pm UTC](https://community.particle.io/t/solved-compile-problem-with-timer/20426/5 "2016-02-24T18:42:21Z")

</div>

> [@ScruffR](#):
>
> I guess you are targeting a Core

What I meant was that I guess your Web IDE was set to target a Core instead of your Photon (which would produce exactly the errors you saw).
