Error: undefined reference to main

The first time I got this error message was 8 years ago when I was “trainee” at Smar Industrial at Sertaozinho with my Friend Marcelo Barros.
Today compiling an ancient version of bluez I received this same error message:

…/usr/lib/crt1.o: In function `_start’:
(.text+0x30): undefined reference to `main’
collect2: ld returned 1 exit status

At that time we didn’t document the solution, but this is not late:

Just add it to your Makefile:

CFLAGS = -nostdlib

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 )

Google+ photo

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

Connecting to %s