NuttX apps compilation issue

If you decide you create your own NuttX application based on apps/examples/hello you could eventually face this issue:

CC: my_app_main.c
:0:6: error: expected identifier or '(' before numeric constant
:0:6: error: expected identifier or '(' before numeric constant
my_app_main.c:51:5: note: in expansion of macro 'main'
int main(int argc, FAR char *argv[])
^
make[3]: *** [/home/alan/apps/Application.mk:189: my_app_main.home.alan.apps.examples.my_app.o] Error 1

This error happens because your PROGNAME defined inside the Kconfig differs from your application name:

config EXAMPLES_MYAPPNAME_PROGNAME
string "Program name"
default "myapp"

If your PROGNAME is myapp then you need to have apps/examples/myapp/myapp_main.c otherwise it will not work. So don’t my_app for your app directory neither my_app_main.c for your main file, it needs to be myapp_main.c

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s