当前位置: 技术问答>linux和unix
一个简单的SOCKET服务端程序,生成执行文件的出错!
来源: 互联网 发布时间:2015-03-17
本文导语: 1:能过如下方式执行(编译可以,但生成执行文件出错) $ gcc -c server.c $ gcc -o server server.o /usr/ccs/bin/ld: Unsatisfied symbols: accpet (first referenced in server.o) (code) collect2: ld returned 1 exit status 2:环境HP 3:源程序如...
1:能过如下方式执行(编译可以,但生成执行文件出错)
$ gcc -c server.c
$ gcc -o server server.o
/usr/ccs/bin/ld: Unsatisfied symbols:
accpet (first referenced in server.o) (code)
collect2: ld returned 1 exit status
2:环境HP
3:源程序如下:
#include
#include
#include
#include
#define MAXBUFSIZE 1024
int main(int argv,char **argc){
struct sockaddr_in server_addr,client_addr;
int listen_socket,conn,len;
socklen_t sock_len;
char buff[MAXBUFSIZE];
if ( (listen_socket=socket(AF_INET,SOCK_STREAM,0))
$ gcc -c server.c
$ gcc -o server server.o
/usr/ccs/bin/ld: Unsatisfied symbols:
accpet (first referenced in server.o) (code)
collect2: ld returned 1 exit status
2:环境HP
3:源程序如下:
#include
#include
#include
#include
#define MAXBUFSIZE 1024
int main(int argv,char **argc){
struct sockaddr_in server_addr,client_addr;
int listen_socket,conn,len;
socklen_t sock_len;
char buff[MAXBUFSIZE];
if ( (listen_socket=socket(AF_INET,SOCK_STREAM,0))