Compile error: undefined reference to 'land_data_main'

Hello everyons.I want to add my example app on PX4 just like px4_simple_app.but I got some problems:
…/…/NuttX/apps/libapps.a(builtin_list.o):(.rodata.g_builtins+0xfc): undefined reference to land_data_main’`

However in land_data.cpp file,there exist land_data_main function.like this:
`__EXPORT int land_data_main(int argc, char *argv[]);

int land_data_main(int argc, char *argv[])
{`
I do not know why I got this problem.who could help me?
thanks!

Have you added your module to the board config?

E.g. for px4_fmu-v2_default it would be this list:

thank you!of course i add it

when I rename my file from .cpp to .c. It Compile and pass.I feel puzzled about it

Try extern "C" __EXPORT like in this C++ example:

yes, you are right!
thank you very much!!!

1 Like