我已经包含了下列这些头文件
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
但是编译时还是提示这些变量未定义,windows里这些变量都在winsock2.h中预定义的,
linux里需要自己预定义这些量吗?
如果不需要,是在哪个头文件定义的呢?
#include <netinet/in.h>
#include <netinet/tcp.h> // for TCP_NODELAY
int main()
{
int a[] = {SOL_SOCKET,SO_RCVTIMEO,SO_SNDTIMEO,IPPROTO_TCP,TCP_NODELAY};
return 0;
}
另:你的标题中有拼写错误 ^_^