在socket编程的过程中头文件中

#include <windows.h>
#include "stdafx.h"
#include "WinSock2.h"

在编译的时候会报错 :error C2011: 'fd_set' : 'struct' type redefinition

解决方法

在所有的#include <windows.h>前使用#define WIN32_LEAN_AND_MEAN,如:

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

这样编译就成功了。原因还不清楚。

解决ERROR C2011: 'FD_SET' : 'STRUCT' TYPE REDEFINITION问题的更多相关文章

  1. 解决error C2011: 'fd_set' : 'struct' type redefinition的方法

    http://www.cnblogs.com/ark-zhang/archive/2013/06/19/3144383.html   首先说明这个问题由于重复定义引起的编译错误. 先说明解决方法,然后 ...

  2. VC中编译报错:error C2011: 'fd_set' : 'struct' type redefinition

    这是头文件包含顺序的问题,原因与解决办法见下面代码的注释. /* 包含下面这两个头文件时,必须把winsock2.h放在前面 否则编译报错,N多的重定义错误:例如 error C2011: 'fd_s ...

  3. ADO编程:error C2011: 'LockTypeEnum' : 'enum' type redefinition

     C++ Code  123   // Import the ADO type library #import "C:\\Program Files\\Common Files\\syste ...

  4. error C2011: “timespec”:“struct”类型重定义

    error C2011: “timespec”:“struct”类型重定义 C++ pthread pthread.h 中的 timespec 和time.h 中的 结构定义重复了 ,同时两个头文件中 ...

  5. error C2011: “Picture”:“struct”类型重定义

    今天引用外来库时出现问题,也许是版本问题. 错误如下: .....\oursun\cincludes\quickdraw.h(309): error C2011: “Picture”:“struct” ...

  6. configure: error: cannot guess build type; you must specify one解决方法

    原文地址:https://blog.csdn.net/hebbely/article/details/53993141 1.configure: error: cannot guess build t ...

  7. 多.h项目出现的问题:使用了预编译头依然出现error LNK2005:***obj已在***obj中定义与c++ error C2011: “xxx”:“class”类型重定义解决办法

    使用了预编译头依然出现error LNK2005:***obj已在***obj中定义 造成该问题的可能性比较多,本人将在今后遇到时添加进来,今天先放出本人遇到的一种情况. 多重包含含有变量定义的.h文 ...

  8. 【Unity Shader】syntax error: unexpected token 'struct' at line x 错误解决办法

    以下代码处出现了syntax error: unexpected token 'struct' at line 33的错误 struct a2v { float4 vertex_position : ...

  9. 编译Cython代码时遇到的问题: fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

    使用python setup.py build_ext --inplace命令编译cython代码, 出现以下错误: Compiling cython_example.pyx because it c ...

随机推荐

  1. XHTML 结构化:使用 XHTML 重构网站

    http://www.w3school.com.cn/xhtml/xhtml_structural_01.asp 我们曾经为本节撰写的标题是:"XHTML : 简单的规则,容易的方针.&qu ...

  2. 设置secureCRT中vim的字体颜色

    1.在/etc/vimrc新增以下一行 syntax on 注:上述方法对root用户无效,原因为在一般用户中,alias vi=vim,而在root用户中默认无此设置,因此若需要root用户也显示颜 ...

  3. jQuery插件教程

    http://www.cnblogs.com/Wayou/p/jquery_plugin_tutorial.html   非常不错的jQuery插件教程

  4. ORACLE的客户端如何连接到数据库

    如何连接oracle数据库及故障解决办法   如何配置才能使客户端连到数据库:     要使一个客户端机器能连接oracle数据库,需要在客户端机器上安装oracle的客户端软件,唯一的例外就是jav ...

  5. Python学习(五) Python数据类型:列表(重要)

    列表: list是一组有序项目的数据结构. 列表是可变类型的数据,列表用[]进行表示,包含了多个以","分隔的项目. list=[] type(list) //<type ' ...

  6. html简单定位

    (1) 两个块水平排列 将两个块都设为浮动即可.注意不能将两个块的position属性设为absolute(绝对定位) #div1{ background-color: red; float:left ...

  7. Roads in the North(POJ 2631 DFS)

    Description Building and maintaining roads among communities in the far North is an expensive busine ...

  8. Dos命令---ipconfig

    Dos命令---ipconfig 作者:vpoet mail:vpoet_sir@163.com ipconfig是很常用的Dos命令,我们可以用ipconfig /?查看该命令的说明.在linux下 ...

  9. 【错误】:MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

    错误:MySql Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' 解决 ...

  10. gdb 调试coredump文件过程

    gdb 调试coredump文件过程: 第一步:首先需要一个进程的coredump文件,怎么搞出coredump文件呢? 1. ps -fax|grep                 进程名称 找到 ...