Search code examples
openmplibgomp

undefined reference to _app_main


I'm trying to run some tests on vsoc_beta using arm-elf-gcc and arm-rtems-gcc. However, both compilers gave me the same error:

/home/student/vsoc-beta/apps/libgomp/root.o: In function `main':
/home/student/vsoc-beta/apps/libgomp/libgomp.c:24: multiple definition of `main'
app_obj.o:/home/student/vsoc-beta/apps/rotate/rot.c:103: first defined here
/home/student/vsoc-beta/apps/libgomp/root.o: In function `main':
root.c:(.text+0x219c): undefined reference to `_app_main'
root.c:(.text+0x2298): undefined reference to `_app_main'
make: *** [o-optimize/app.exe] Error 1

These tests are using libgomp and in libgomp.c there's a line:

extern int _app_main(int argc, char **argv, char **envp);

and the main is defined as:

int main(int argc, char **argv, char **envp)

In the test files, there is another main function:

int main(int argc, char **argv)

What could be the problem?


Solution

  • As the first error is a "Multiple definition of main" you must decide first which of the 2 main function you have is the application entry point.

    An application as only one entry point or main function.