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

Undefined Reference to `round' using nrf sdk for mesh

Hi I am trying to use the math library within the dimming example of nRF SDK for Mesh package.

I am getting a linker error saying "undefined reference to `round' using nrf sdk for mesh" and do not see where to add the math library reference to the cmake text file. Whenever I add the path to libgcc.a to the target_link_libraries command it does not work.

Is there a way to fix this?

Parents
  • Hi,

    The math library is a bit special, and to add it to the target_link_libraries (or otherwise specify it when building) you only refer to it as "m". (That is, a single character m.)

    If you use Segger Embedded Studio then no actions should be needed for getting the math library linked into the project (it happens already.)

    If you build using the cmake based toolchain, this is what the target_link_libraries part of CMakeLists.txt for the dimming example should look like in order to use the math library:

    target_link_libraries(${target}
        rtt_${PLATFORM}
        uECC_${PLATFORM}
    	m)

    Regards,
    Terje

Reply
  • Hi,

    The math library is a bit special, and to add it to the target_link_libraries (or otherwise specify it when building) you only refer to it as "m". (That is, a single character m.)

    If you use Segger Embedded Studio then no actions should be needed for getting the math library linked into the project (it happens already.)

    If you build using the cmake based toolchain, this is what the target_link_libraries part of CMakeLists.txt for the dimming example should look like in order to use the math library:

    target_link_libraries(${target}
        rtt_${PLATFORM}
        uECC_${PLATFORM}
    	m)

    Regards,
    Terje

Children
No Data
Related