Hello_word example for Linux won't compile

I’ve been using WinCE on Toradex modules for many years and now I am trying to learn to use Embedded Linux instead. I have followed this tutorial to set-up a development machine running Ubuntu:
How to setup environment for Embedded Linux application development

Using that tutorial I was also able to install Linux image 2.8.1 on a T20 module installed in an Iris development board.

Next I followed the hello world tutorial for Eclipse: Hello World application on Embedded Linux

The code I am trying to compile is:

#include <stdio.h>                  // standard I/O header file
 
int main(int argc, char **argv)
{
     printf("\nHello World !!!\n");        // print "Hello World" message on screen
     return(0);
}

Eclipse reported a linker error which I can’t figure out:

15:49:32 **** Build of configuration Debug for project hello_world ****
make all 
Building file: ../hello_world.c
Invoking: Cross GCC Compiler
arm-linux-gnueabihf-gcc -O0 -march=armv7-a -fno-tree-vectorize -mthumb-interwork -mfloat-abi=hard -mtune=cortex-a9 -Wno-poison-system-directories -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"hello_world.d" -MT"hello_world.d" -o "hello_world.o" "../hello_world.c"
Finished building: ../hello_world.c
 
Building target: hello_world
Invoking: Cross GCC Linker
arm-linux-gnueabihf-gcc -L/srv/nfs/rootfs/usr/lib -Wl,-rpath-link,/srv/nfs/rootfs/usr/lib -L/srv/nfs/rootfs/lib -Wl,-rpath-link,/srv/nfs/rootfs/lib -o "hello_world"  ./hello_world.o   
/home/snaddenm/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/../arm-linux-gnueabihf/libc/usr/lib/crt1.o: In function `_start':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/arm-linux-gnueabihf/snapshots/glibc.git~linaro~2.23~master/csu/../sysdeps/arm/start.S:119: undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [hello_world] Error 1
makefile:29: recipe for target 'hello_world' failed

15:49:32 Build Finished (took 243ms)

Any help much appreciated!

I figured it out. Eclipse had deleted the main() function from my source code file for some reason, leaving only the comment header, and I didn’t notice. It’s working now that the source code matches what I posted earlier.

Perfect. Thanks for letting us know!