简体   繁体   中英

gcc error compiling file

[user@user Book]$ gcc -o notesearch.c notesearch
notesearch: In function `__x86.get_pc_thunk.bx':
(.text+0x30): multiple definition of `__x86.get_pc_thunk.bx'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crti.o:(.gnu.linkonce.t.__x86.get_pc_thunk.bx+0x0): first defined here
notesearch: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crti.o:(.fini+0x0): first defined here
notesearch: In function `data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crt1.o:(.data+0x0): first defined here
notesearch: In function `data_start':
(.data+0x4): multiple definition of `__dso_handle'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/crtbegin.o:(.data+0x0): first defined here
notesearch:(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crt1.o:(.rodata.cst4+0x0): first defined here
notesearch: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crt1.o:(.text+0x0): first defined here
notesearch:(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crt1.o:(.rodata+0x0): first defined here
notesearch: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/../../../crti.o:(.init+0x0): first defined here
/usr/lib/gcc/i686-pc-linux-gnu/4.9.2/crtend.o:(.tm_clone_table+0x0): multiple definition of `__TMC_END__'
notesearch:(.data+0x8): first defined here
/usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored.
/usr/bin/ld: error in notesearch(.eh_frame); no .eh_frame_hdr table will be created.
collect2: error: ld returned 1 exit status
[user@user Book]$

I am trying to compile notesearch.c from the book "hacking the art of exploitation" and I get an error. I remember being able to do it just fine. I am on a x86 3.16.7.4-1-MANJARO Linux computer.

You need to say gcc -o notesearch notesearch.c . Otherwise, you are OUTPUTTING ( -o ) to the .c file, which is not good. Also, you may want to consider compiling with these other flags:

-Wall : Warn All, very useful. -Werror : Again, very useful. -g : This is my favorite flag. It compiles with debug symbols, so that you can start you program in gdb (Gnu DeBugger) and then examine what is happening, change values of variables during execution, and generally debug it. gdb is VERY helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM