How to use -nostdlib?

Peng Yu
Thu May 14 03:19:00 GMT 2015

I tried the following commands which are supposed to work, but didn't.
Does anybody know what is wrong? Thanks.

$ cat test.c
#include <stdio.h>
int main() {
  printf("Hello World\n");
$ gcc -nostdlib -o test_nostdlib test.c
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
/tmp/ccZBi5G9.o: In function `main':
test.c:(.text+0xa): undefined reference to `puts'
collect2: error: ld returned 1 exit status


More information about the Gcc-help mailing list