#include <nuttx/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int hello_main(int argc, char *argv[])
#endif
{
if (argc < 2)
{
static char * const args[2] =
{
"/bin/ls",
NULL
};
execv(args[0], args);
}
else
{
int i;
for (i = 1; i < argc; i++)
{
static char * const args[3] =
{
"/bin/ls",
NULL,
NULL
};
args[1] = argv[i];
execv(args[0], args);
}
}
return EXIT_SUCCESS;
}
hello_main.c:(.text.hello_main+0xe): undefined reference to `execv'
xtensa-esp32-elf-ld: hello_main.c:(.text.hello_main+0x20): undefined reference
to `execv'
make[1]: *** [Makefile:173: nuttx] Error 1
make: *** [tools/Unix.mk:537: nuttx] Error 2