(homekit) example-homekit/src/Main.c:278:3: error: implicit declaration of function 'mgos_gpio_setup_mode'

I’m using the example from git@github.com:mongoose-os-apps/example-homekit.git and I can get it to work (pair, see it on the phone etc.) after flashing it to a NodeMCU ESP8226. My next step was to blink the LED on in response to the Home app, so I #include “mgos_gpio.h” and then in the App init:

mgos_gpio_setup_mode(16, MGOS_GPIO_MODE_OUTPUT);

and in lightbulbwrite, I added

mgos_gpio_write(16, value);

I can’t build the firmware however, the error I get is

example-homekit/src/Main.c: In function ‘mgos_app_init’:
example-homekit/src/Main.c:278:3: error: implicit declaration of function ‘mgos_gpio_setup_mode’ [-Werror=implicit-function-declaration]
mgos_gpio_setup_mode(16, MGOS_GPIO_MODE_OUTPUT);
^

I tried adding

libs:

and also updating mos to the lastest:

$ mos version
The Mongoose OS command line tool
Version: 202002172132
Build ID: 202002172132~brew
Update channel: latest

I guess it’s finding the includes, but not linking against the object file containing the gpio functions. Not sure how to do that though.

The function you need is mgos_gpio_set_mode.

Ugh the shame. I must have stared at that for hours. Sorry for wasting your time! :frowning_face: Thanks for pointing it out to me though.