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

Undefine reference to "app_timer_start"

Hi,

I faced a problem while building my project. Please see screenshot below

I think I have already include all the files and everything compiled. But this error shows up at the very end. Please advise. 

Thank you.

Parents
  • Did you include app_timer.h in main.c?you should also include the .h in user includes! for some files, you also need to include the .c file in the project directory tree (i get a similar error when my app_timer.c isn't in the file tree) If you're using the template project all this should already be set up.

  • Not having the header #included in the source where needed would give compiler errors (or warnings) - but these are Linker errors.

    The header gives the necessary declarations to the compiler - but the Linker needs to see the definitions.

    http://c-faq.com/decl/decldef.html

    This error usually means that the header has been #included in the source (giving the declarations to the Compiler) - but the .c (or pre-built binary) containing the definitions is missing - hence the Linker complains about things being "un-defined"

    The above is standard 'C' stuff - not specific to Nordic or microcontrollers.

    But with the Nordic SDK specifically there is an extra twist: many features have to be enabled by settings in the sdk_config.h;  so, even with the correct headers #included, and all the correct .c files in the Project, you can still get 'Undefined' Linker errors - because the content of the 'C' files is disabled by conditional compilation such as:

    #if NRF_MODULE_ENABLED(NRF_CLOCK)
    
    

Reply
  • Not having the header #included in the source where needed would give compiler errors (or warnings) - but these are Linker errors.

    The header gives the necessary declarations to the compiler - but the Linker needs to see the definitions.

    http://c-faq.com/decl/decldef.html

    This error usually means that the header has been #included in the source (giving the declarations to the Compiler) - but the .c (or pre-built binary) containing the definitions is missing - hence the Linker complains about things being "un-defined"

    The above is standard 'C' stuff - not specific to Nordic or microcontrollers.

    But with the Nordic SDK specifically there is an extra twist: many features have to be enabled by settings in the sdk_config.h;  so, even with the correct headers #included, and all the correct .c files in the Project, you can still get 'Undefined' Linker errors - because the content of the 'C' files is disabled by conditional compilation such as:

    #if NRF_MODULE_ENABLED(NRF_CLOCK)
    
    

Children
No Data
Related