开发者

When compiling,I write " gcc -g -Wall dene2 dene2.c", then gcc emits some trace

When I compile my code,I write gcc -g -Wall dene2 dene2.c in the console. Then gcc emits some text on the screen. I don't understand what this output means (I couldn't th开发者_JAVA百科ink of a meaningful title for that reason, sorry).

I have tried Google searching but haven't had any luck.

I'm not asking for a detailed examination of all of the output below. Just show me "how to catch fish".

dene2: In function `_start':
    /build/buildd/eglibc-2.10.1/csu/../sysdeps/i386/elf/start.S:65: multiple 
       definition of `_start'
   /usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o:/build/buildd/eglibc-2.10.1
      /csu/../sysdeps/i386/elf/start.S:65: first defined here
dene2:(.rodata+0x0): multiple definition of `_fp_hw'
   /usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o:(.rodata+0x0): first 
     defined here
dene2: In function `_fini':
   (.fini+0x0): multiple definition of `_fini'
   /usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crti.o:(.fini+0x0): first defined 
      here
dene2:(.rodata+0x4): multiple definition of `_IO_stdin_used'
   /usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o:(.rodata.cst4+0x0): first 
     defined here
dene2: In function `__data_start':
 (.data+0x0): multiple definition of `__data_start'
   /usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crt1.o:(.data+0x0): first defined 
     here
dene2: In function `__data_start':
 (.data+0x4): multiple definition of `__dso_handle'
  /usr/lib/gcc/i486-linux-gnu/4.4.1/crtbegin.o:(.data+0x0): first defined here
dene2: In function `_init':
 (.init+0x0): multiple definition of `_init'
  /usr/lib/gcc/i486-linux-gnu/4.4.1/../../../../lib/crti.o:(.init+0x0): first defined 
       here
  /tmp/ccMlGkkV.o: In function `main':
  /home/fatih/Desktop/dene2.c:5: multiple definition of `main'
dene2:(.text+0xb4): first defined here
  /usr/lib/gcc/i486-linux-gnu/4.4.1/crtend.o:(.dtors+0x0): multiple definition of 
     `__DTOR_END__'
dene2:(.dtors+0x4): first defined here
  collect2: ld returned 1 exit status


I think you probably want a -o in that command line:

gcc -g -Wall -o dene2 dene2.c

What you have there without the -o is trying to link dene2 with the result of compiling dene2.c. dene2 is probably left over in your directory from previous build attempt. That's why you're seeing all the duplicate symbol errors.


You are missing the -o in your compile line.

gcc -g -Wall -o dene2 dene2.c

The linker is trying to link your executable together with the source code you're current compiling, resulting in multiple definitions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜