求助:链接错误
E:\resource\c>gcc ex1.c
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0x6d):ex1.c: undefined r
eference to `socket@12'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0xa0):ex1.c: undefined r
eference to `htonl@4'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0xb6):ex1.c: undefined r
eference to `htons@4'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0xd4):ex1.c: undefined r
eference to `bind@12'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0xfb):ex1.c: undefined r
eference to `listen@8'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0x15f):ex1.c: undefined
reference to `FD_SET_'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0x192):ex1.c: undefined
reference to `select@20'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0x1c9):ex1.c: undefined
reference to `__WSAFDIsSet@8'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0x1f3):ex1.c: undefined
reference to `accept@12'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0x2cb):ex1.c: undefined
reference to `__WSAFDIsSet@8'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/cciGaaaa.o(.text+0x303):ex1.c: undefined
reference to `closesocket@4'
E:\resource\c>gcc ex1.c
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0x6d):ex1.c: undefined r
eference to `socket@12'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0xa0):ex1.c: undefined r
eference to `htonl@4'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0xb6):ex1.c: undefined r
eference to `htons@4'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0xd4):ex1.c: undefined r
eference to `bind@12'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0xfb):ex1.c: undefined r
eference to `listen@8'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0x15f):ex1.c: undefined
reference to `FD_SET_'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0x192):ex1.c: undefined
reference to `select@20'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0x1c9):ex1.c: undefined
reference to `__WSAFDIsSet@8'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0x1f3):ex1.c: undefined
reference to `accept@12'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0x2cb):ex1.c: undefined
reference to `__WSAFDIsSet@8'
C:\DOCUME~1\D10A53~1.000\LOCALS~1\Temp/ccCsaaaa.o(.text+0x303):ex1.c: undefined
reference to `closesocket@4'
E:\resource\c>
用dev-c++带的gcc 编译发生这样的错误
怎么解决啊已经包含了如下的头文件啊
#include <winsock.h>
#include <winsock2.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <_mingw.h>