【发布时间】:2013-06-15 14:13:18
【问题描述】:
我正在尝试编译代码
#include <Header1.h>
#include "Header2..h"
#include <ctype.h>
Header1.h 包括winsock.h 和Header2.h 包括windows.h
我使用winsock.h 而不是winsock2.h,因为winsock2.h 显示重新定义错误,这是一个标准错误,但我无法使用提供给他们的解决方案来解决这个问题。
我也尝试过包含ws2tcpip.h,但它在winsock.h 中给出了大量的重新定义错误。
我在这个模块中遇到 12 个错误
error C3861: 'close': identifier not found
error C2664: 'setsockopt' : cannot convert parameter 4 from 'timeval *' to 'const char *'
error C2065: 'socklen_t' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'optionLength'
error C2065: 'optionLength' : undeclared identifier
error C2065: 'optionLength' : undeclared identifier
error C2664: 'setsockopt' : cannot convert parameter 4 from 'int32 *' to 'const char *'
error C2065: 'MSG_WAITALL' : undeclared identifier
error C2664: 'recvfrom' : cannot convert parameter 2 from 'uint8 *' to 'char *'
error C2065: 'ERROR_END_OF_STREAM' : undeclared identifier
error C3861: 'close': identifier not found
error C3861: 'close': identifier not found
【问题讨论】:
-
你能分享给你错误的代码吗?
标签: c++ visual-studio-2008 networking winsock winsock2