当前位置: 技术问答>linux和unix
socket编程出现的错误,如何解决????
来源: 互联网 发布时间:2015-04-13
本文导语: 我编写一个客户端程序时,编译时出现一下错误,请问是什么问题? Undefined first referenced symbol in file inet_aton ...
我编写一个客户端程序时,编译时出现一下错误,请问是什么问题?
Undefined first referenced
symbol in file
inet_aton /var/tmp/ccDT7bok.o
ld: fatal: Symbol referencing errors. No output written to test
collect2: ld returned 1 exit status
编译时已经是使用了gcc -o test testclient.c -lsocket
程序源代码如下:
#include
#include
#include
#include
#define MAXBUFSIZE 1024
int main(int argv,char **argc){
struct sockaddr_in name;
int sock,n;
char buf[MAXBUFSIZE];
struct in_addr addr;
if(( sock=socket(AF_INET,SOCK_STREAM,0))
Undefined first referenced
symbol in file
inet_aton /var/tmp/ccDT7bok.o
ld: fatal: Symbol referencing errors. No output written to test
collect2: ld returned 1 exit status
编译时已经是使用了gcc -o test testclient.c -lsocket
程序源代码如下:
#include
#include
#include
#include
#define MAXBUFSIZE 1024
int main(int argv,char **argc){
struct sockaddr_in name;
int sock,n;
char buf[MAXBUFSIZE];
struct in_addr addr;
if(( sock=socket(AF_INET,SOCK_STREAM,0))