crt1.o: In function `_start': - undefined reference to `main' in Linux

Try adding -nostartfiles to your linker options, i.e.

$(LINK) -nostartfiles -g ...

From the gcc documentation:

-nostartfiles
    Do not use the standard system startup files when linking. The standard system libraries are used normally, unless -nostdlib or -nodefaultlibs is used. 

This causes crt1.o not to be linked (it's normally linked by default) - normally only used when you implement your own _start code.


-shared link option must be used when you compile a .so


The issue for me was, I by mistake put int main() in a namespace. Make sure don't do that otherwise you will get this annoying link error.

Hope this helps anyone :)