1. 程式人生 > >gcc: multiple definition of

gcc: multiple definition of

gcc -o foda list.o main.o udp_socket.o  -lcstl -lpthread
udp_socket.o:(.data+0x0): multiple definition of `udp_sockfd'
main.o:(.data+0x0): first defined here
udp_socket.o:(.bss+0x0): multiple definition of `send_queue'
main.o:(.bss+0x0): first defined here
udp_socket.o:(.bss+0x4): multiple definition of `recv_queue'
main.o:(.bss+0x4): first defined here
udp_socket.o:(.bss+0x8): multiple definition of `recv_list'
main.o:(.bss+0x8): first defined here
但是在編譯的flag上加上-Xlinker -zmuldefs這句就通過了,破問題害我浪費了幾個小時的時間