0

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?

1 Answers1

1

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.

jhui
  • 694
  • 4
  • 3
  • Thank you for your answer. Could you tell me how to disable MTD and RCP in build options? – JStand Jakub Standarski Jul 21 '20 at 09:37
  • If you are using the convenience makefiles in [`examples/`](https://github.com/openthread/openthread/tree/master/examples), you can look for `configure_OPTIONS`. Remove mentions of `--enable-mtd` and `--enable-radio-only`. – jhui Jul 21 '20 at 16:55
  • Great :) Thank you very much. I have solved my problem by adding `#ifdef OPENTHREAD_FTD`, nevertheless it is valuable information :) – JStand Jakub Standarski Jul 22 '20 at 08:14