This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Where to put APP_TIMER_DEF without error or warning?

I am working on a project in Nordic SDK 8.1 that requires using a timer. I am confused where I need to define the timer though (using APP_TIMER_DEF). If I put it right after my #include statements I get the following error: ../../../main.c:39:1: warning: data definition has no type or storage class [enabled by default] APP_TIMER_DEF(m_slave_timeout_id);

I Googled the error and it said I need to place it in a function so there is somewhere for the data to be saved. Because of this I tried putting it at the top of my main() function. When I do that I get the following error though: main.c:(.text.startup.main+0x6): undefined reference to `APP_TIMER_DEF'

Where should I put this code?

Related