0
我有makefile的錯誤,當我嘗試編譯可執行文件.o文件 錯誤列表:的Makefile和gktmm-3的.o錯誤
g++ -g -Wall -o main main.o `pkg-config --cflags --libs gtkmm-3.0`
main.o: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o:(.text+0x0): first defined here
main.o: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crti.o:(.fini+0x0): first defined here
main.o:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o:(.rodata.cst4+0x0): first defined here
main.o: In function `data_start':
(.data+0x0): multiple definition of `__data_start'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crt1.o:(.data+0x0): first defined here
main.o: In function `data_start':
(.data+0x8): multiple definition of `__dso_handle'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/crtbegin.o:(.data+0x0): first defined here
main.o: In function `_init':
(.init+0x0): multiple definition of `_init'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/crti.o:(.init+0x0): first defined here
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/crtend.o:(.tm_clone_table+0x0): multiple definition of `__TMC_END__'
main.o:(.data+0x10): first defined here
/usr/bin/ld: error in main.o(.eh_frame); no .eh_frame_hdr table will be created.
collect2: error: ld returned 1 exit status
makefile:12: recipe for target 'main' failed
make: *** [main] Error 1
和Makefile是
NAME=main
CFLAGS=-g -Wall -o $(NAME)
LIBFLAGS=`pkg-config --cflags --libs gtkmm-3.0`
SRCS=main.cpp
CC=g++
OBJECTS=$(SRCS:.cpp=.o)
all: main
main: $(SRCS)
$(CC) $(CFLAGS) $(OBJECTS) $(LIBFLAGS)
.cpp.o:
$(CC) $(CFLAGS) $< -o [email protected]
有人可以解釋我的錯誤嗎?我知道這不是最好的makefile。