//加了所有需要的头文件
int
main(int argc, char **argv)
{
struct event timeout;
struct timeval tv;
struct event_base *base;
int flags;
//printf("pathvar=%s",getenv("PATH")); 注释1
#ifdef WIN32
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2, 2);
(void)WSAStartup(wVersionRequested, &wsaData);
#endif
//printf("pathvar=%s",getenv("PATH")); 注释2
return (0);
}
为什么我把输出的代码放在注释1的位置编译后产生这样的错误
1> d:\program files (x86)\microsoft visual studio 10.0\vc\include\stdlib.h(433) : 参见“getenv”的声明
1>f:\libevent-2.0.22-stable\sample\time-test.c(71): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
1>f:\libevent-2.0.22-stable\sample\time-test.c(72): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
1>f:\libevent-2.0.22-stable\sample\time-test.c(73): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
1>f:\libevent-2.0.22-stable\sample\time-test.c(74): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
1>f:\libevent-2.0.22-stable\sample\time-test.c(77): error C2275: “WORD”: 将此类型用作表达式非法
而放在注释2就不会有错误。