nrf52openthread

OpenThread API: undefined reference to otThreadGetMaxAllowedChildren()


I have the problem with compilation. After adding function call otThreadGetMaxAllowedChildren() in the openthread/examples/apps/cli/main.c I got an error:

openthread/examples/apps/cli/main.c:228: undefined reference to `otThreadGetMaxAllowedChildren'

Similary, the same issue with otThreadGetChildInfoByIndex():

openthread/examples/apps/cli/main.c:204: undefined reference to `otThreadGetChildInfoByIndex'

I have added -DOPENTHREAD_FTD=1 flag, but error still occurs.

Any idea what should I do to make compilation successful?


Solution

  • The otThreadGetChildInfoByIndex() is only available for FTD builds.

    You should either:

    1. Disable MTD and RCP in your build options, or

    2. Wrap your child table code with #if OPENTHREAD_FTD.

    You can refer to the CLI code for example usage.