Chinaunix首页 | 论坛 | 博客
  • 博客访问: 544735
  • 博文数量: 252
  • 博客积分: 6057
  • 博客等级: 准将
  • 技术积分: 1635
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-21 10:17
文章分类

全部博文(252)

文章存档

2013年(1)

2012年(1)

2011年(32)

2010年(212)

2009年(6)

分类: 项目管理

2010-08-06 19:03:38

undefined reference to

hxzon:缺少libwsock32.a 。在 Dev-Cpp\lib 和 mingw\lib 下。

==================
我用DEVCPP4.9.7.8编译一SOCKET程序时出现如下编译连接错误:
Compiler: Default compiler
Building Makefile: "F:\sock\Makefile.win"
Executing make...
make.exe -f "F:\sock\Makefile.win" all
gcc.exe server.o -o "Server.exe" -L"C:/Dev-Cpp/lib"

server.o(.text+0x2d7):server.c: undefined reference to `recv@16'
server.o(.text+0x301):server.c: undefined reference to `WSAGetLastError@0'
server.o(.text+0x395):server.c: undefined reference to `send@16'

server.o(.text+0x3bd):server.c: undefined reference to `WSAGetLastError@0'
server.o(.text+0x4b5):server.c: undefined reference to `WSAStartup@8'
server.o(.text+0x4e6):server.c: undefined reference to `socket@12'
server.o(.text+0x502):server.c: undefined reference to `WSAGetLastError@0'
server.o(.text+0x532):server.c: undefined reference to `inet_addr@4'
server.o(.text+0x55a):server.c: undefined reference to `htonl@4'
server.o(.text+0x57e):server.c: undefined reference to `htons@4'
server.o(.text+0x5a2):server.c: undefined reference to `bind@12'
server.o(.text+0x5b4):server.c: undefined reference to `WSAGetLastError@0'
server.o(.text+0x5e1):server.c: undefined reference to `listen@8'
server.o(.text+0x613):server.c: undefined reference to `accept@12'
server.o(.text+0x62f):server.c: undefined reference to `WSAGetLastError@0'
server.o(.text+0x657):server.c: undefined reference to `ntohs@4'

server.o(.text+0x66f):server.c: undefined reference to `inet_ntoa@4'
server.o(.text+0x6fb):server.c: undefined reference to `closesocket@4'
server.o(.text+0x703):server.c: undefined reference to `WSACleanup@0'

make.exe: *** [Server.exe] Error 1

Execution terminated
这是什么原因引起的?
---------------------------
先找到:菜单 Project->project Options ->中的"Linker Options/Optonal Libs or Obeject files ",
点击右边的"Add Library or Object" --> 在你的..\lib目录中找到:"libwsock32.a",选中,点击"打开"-->返回后再按"ok",
重新编译链接即可.   

阅读(4282) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~