相关疑难解决方法(0)

编译.c代码时socklen_t未声明

我试图使用MinGW(gcc file.c -o compiled.exe)在Windows中编译此.c代码:

/***************************************************/ 
/* AUTHOR         :  LAW CHIU YUEN                 */
/* FILENAME     :  smtpr.c                         */
/***************************************************/ 

#ifdef WIN32
#include <windows.h>
#include <winsock.h>
#else
#define closesocket close
#include <unistd.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#endif

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <arpa/inet.h>
#include <ctype.h>


//#define MYPORT 40711    // the port users will be connecting to
#define PORT 25
#define MAXBUFLEN 1024      // max buffer size
#define RELAY_NAME 255 // max length of file …
Run Code Online (Sandbox Code Playgroud)

c sockets windows compiler-construction compiler-errors

14
推荐指数
3
解决办法
3万
查看次数