青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Where there is a dream ,there is hope

  C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
  64 Posts :: 0 Stories :: 8 Comments :: 0 Trackbacks

常用鏈接

留言簿(1)

我參與的團隊

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

今天寫一個小程序出現了這種問題:
>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(91) : warning C4005: “AF_IPX”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(460) : 參見“AF_IPX”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(127) : warning C4005: “AF_MAX”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(479) : 參見“AF_MAX”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(163) : warning C4005: “SO_DONTLINGER”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(402) : 參見“SO_DONTLINGER”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(206) : error C2011: “sockaddr”: “struct”類型重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(485) : 參見“sockaddr”的聲明
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(384) : error C2143: 語法錯誤 : 缺少“}”(在“常量”的前面)
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(384) : error C2143: 語法錯誤 : 缺少“;”(在“常量”的前面)
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(384) : error C2059: 語法錯誤 : “常量”
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(437) : error C2143: 語法錯誤 : 缺少“;”(在“}”的前面)
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(437) : error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(437) : error C4430: 缺少類型說明符 - 假定為 int。注意: C++ 不支持默認 int
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(518) : warning C4005: “IN_CLASSA”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(287) : 參見“IN_CLASSA”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(524) : warning C4005: “IN_CLASSB”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(293) : 參見“IN_CLASSB”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(530) : warning C4005: “IN_CLASSC”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(299) : 參見“IN_CLASSC”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(541) : warning C4005: “INADDR_ANY”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(304) : 參見“INADDR_ANY”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(543) : warning C4005: “INADDR_BROADCAST”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(306) : 參見“INADDR_BROADCAST”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\ws2def.h(577) : error C2011: “sockaddr_in”: “struct”類型重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(312) : 參見“sockaddr_in”的聲明
1>c:\program files\microsoft sdks\windows\v6.0a\include\winsock2.h(132) : error C2011: “fd_set”: “struct”類型重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(68) : 參見“fd_set”的聲明
1>c:\program files\microsoft sdks\windows\v6.0a\include\winsock2.h(167) : warning C4005: “FD_SET”: 宏重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(102) : 參見“FD_SET”的前一個定義
1>c:\program files\microsoft sdks\windows\v6.0a\include\winsock2.h(176) : error C2011: “timeval”: “struct”類型重定義
1>        c:\program files\microsoft sdks\windows\v6.0a\include\winsock.h(111) : 參見“timeval”的聲明


好久沒寫TCP的程序了,都忘記是怎么回事了,隱約記得解決方法很簡單。搜索了一下,記錄下來:

引用鏈接:http://www.cnblogs.com/tonyyang132/archive/2009/10/14/1583110.html

初看到如此一堆的錯誤委實不爽,但是只要將二者的包含順序調換一下問題就會解決,原因參見下面那個鏈接。另外,上述問題不僅影響直接包含二者的文件,還影響間接包含的情形。比如,a.h包含了windows.h,b.h包含了winsock2.h,如果在c.h當中要引用a.h和b.h,那么正確的順序應當是b.h先于a.h。當然,實踐當中有時很難找到究竟是哪兩個文件順序不對了,終極的解決辦法是,在當前工程(就是編譯不過的這個工程)所有include語句最前面加上#include <winsock2.h>和#include<windows.h>,世界清靜了。


關于WINSOCK.H與winsock2.h中的重定義解決辦法分析
問題描述:在 VC 6.0中使用socket相關的函數時沒有什么問題,可是到了.net下就有以下類似的錯誤,
[C++ Error] winsock2.h(109): E2238 Multiple declaration for 'fd_set'
[C++ Error] winsock.h(54): E2344 Earlier declaration of 'fd_set'
[C++ Error] winsock2.h(112): E2146 Need an identifier to declare
[C++ Warning] winsock2.h(144): W8017 Redefinition of 'FD_SET' is not identical
[C++ Error] winsock2.h(153): E2238 Multiple declaration for 'timeval'
[C++ Error] winsock.h(97): E2344 Earlier declaration of 'timeval'
[C++ Error] winsock2.h(209): E2238 Multiple declaration for 'hostent'
[C++ Error] winsock.h(153): E2344 Earlier declaration of 'hostent'
[C++ Error] winsock2.h(222): E2238 Multiple declaration for 'netent'
[C++ Error] winsock.h(166): E2344 Earlier declaration of 'netent'
[C++ Error] winsock2.h(229): E2238 Multiple declaration for 'servent'
[C++ Error] winsock.h(173): E2344 Earlier declaration of 'servent'
[C++ Error] winsock2.h(241): E2238 Multiple declaration for 'protoent'
[C++ Error] winsock.h(185): E2344 Earlier declaration of 'protoent'
[C++ Error] winsock2.h(327): E2238 Multiple declaration for 'in_addr'
[C++ Error] winsock.h(269): E2344 Earlier declaration of 'in_addr'
[C++ Error] winsock2.h(385): E2238 Multiple declaration for 'sockaddr_in'
[C++ Error] winsock.h(319): E2344 Earlier declaration of 'sockaddr_in'
[C++ Error] winsock2.h(395): E2238 Multiple declaration for 'WSAData'
[C++ Error] winsock.h(329): E2344 Earlier declaration of 'WSAData'
[C++ Error] winsock2.h(411): E2146 Need an identifier to declare
[C++ Warning] winsock2.h(455): W8017 Redefinition of 'SO_DONTLINGER' is not identical
[C++ Warning] winsock2.h(512): W8017 Redefinition of 'AF_IPX' is not identical
[C++ Warning] winsock2.h(540): W8017 Redefinition of 'AF_MAX' is not identical
[C++ Error] winsock2.h(546): E2238 Multiple declaration for 'sockaddr'
[C++ Error] winsock.h(492): E2344 Earlier declaration of 'sockaddr'
[C++ Error] winsock2.h(586): E2238 Multiple declaration for 'sockproto'
[C++ Error] winsock.h(501): E2344 Earlier declaration of 'sockproto'
[C++ Error] winsock2.h(625): E2238 Multiple declaration for 'linger'
[C++ Error] winsock2.h(625): E2228 Too many error or warning messages

Solution:

This problem arises because windows.h (at least, that version of it) includes not winsock2.h but winsock.h; sadly when Microsoft wrote winsock2.h they chose neither to change windows.h to include winsock2.h, which replaces winsock.h, nor to include windows.h from winsock2.h and then add the definitions for the new Winsock 2 API methods & structures (this might seem reasonable since Winsock 2 does, strictly speaking, replace Winsock 1, but since the API must be fully backwards-compatible the distinction is somewhat meaningless and there's no real benefit to making winsock2.h standalone).

The fix is thankfully simple: always "#include <winsock2.h>" before windows.h.

However, you must remember that if windows.h has been included by (for example) a higher-level header file that is subsequently including your header file, it's too late - so you must make sure that the higher-level header files respect this convention also.

It is however rarely necessary to modify the header files of libraries or other code modules you are using just because you include their header files, and their header files include windows.h - you can just include winsock2.h before you include the library's header files.


在包含jrtplib有時候我也遇到這個問題,解決方法與之相同。一句話,在#include<windows.h>之前 #include <winsock2.h> 問題就可以解決。

問題描述]
   在包含了<windows.h>以及<winsock2.h>的工程中,編譯有時會出現如
下錯誤:

     error C2011: 'fd_set' : 'struct' type redefinition
     error C2011: 'timeval' : 'struct' type redefinition
                     ....
     error C2375: 'accept' : redefinition; different linkage
[原因分析]
   主要原因是因為<windows.h>中包含了<winsock.h>頭文件,由于其版
本的不同,導致出
現上述的錯誤。<windows.h>中相關代碼如下:
               #ifndef WIN32_LEAN_AND_MEAN
               #include <cderr.h>
               #include <dde.h>
               #include <ddeml.h>
               ........
                #ifndef _MAC
               #include <winperf.h>
               #include <winsock.h>
               #endif
                .......

               #include <commdlg.h>
               #endif
               #endif
[解決方案]
    由以上代碼可以看出如果在沒有定義WIN32_LEAN_AND_MEAN宏
的大前
提下windows.h有可能包含winsock.h 頭文件,因此我們得出一個很簡單
的解決方
法就是在包含<windows.h>之前定義WIN32_LEAN_AND_MEAN宏,如
下所示:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

posted on 2010-12-07 15:30 IT菜鳥 閱讀(1174) 評論(0)  編輯 收藏 引用 所屬分類: TCP/IP

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            欧美成人免费在线观看| 欧美精品一区二区三区久久久竹菊 | 国产欧美日韩精品一区| 狠狠色丁香婷婷综合影院| 亚洲性人人天天夜夜摸| 日韩网站免费观看| 久久亚洲精品网站| 亚洲欧美国产制服动漫| 国产精品国产亚洲精品看不卡15| 日韩视频在线你懂得| 亚洲国产高清aⅴ视频| 久久亚洲综合色一区二区三区| 国产一区二区三区高清| 久久高清一区| 久久精品一区蜜桃臀影院| 中文精品99久久国产香蕉| 欧美日韩高清在线播放| 一本久久青青| 一区二区激情小说| 国产精品美女主播| 久久精品导航| 久久九九久精品国产免费直播 | 一区二区在线观看视频| 久久全国免费视频| 久久精品道一区二区三区| 国语对白精品一区二区| 亚洲成人在线视频播放| 久久www成人_看片免费不卡| 狠狠色丁香久久婷婷综合_中| 久久久久99精品国产片| 久久久精品国产免费观看同学| 亚洲欧美综合v| 亚洲第一精品福利| 亚洲私人黄色宅男| 亚洲激情欧美| 欧美一二区视频| 99国产精品99久久久久久| 午夜日韩电影| 亚洲天堂成人在线观看| 久久综合一区| 国产精品电影在线观看| 欧美凹凸一区二区三区视频| 国产精品免费看久久久香蕉| 欧美激情综合色| 国产在线播精品第三| 在线一区观看| 亚洲国产一区二区在线| 欧美亚洲网站| 午夜视频久久久| 欧美少妇一区| 亚洲国产日韩欧美| 精品成人一区二区三区四区| 亚洲自拍高清| 欧美一二区视频| 欧美好骚综合网| 亚洲二区在线| 久热精品在线视频| 欧美mv日韩mv国产网站| 精品成人在线| 久久九九99视频| 久久噜噜噜精品国产亚洲综合| 国产精品一区三区| 亚洲欧美日韩精品综合在线观看| 亚洲午夜未删减在线观看| 美女诱惑黄网站一区| 国产一区二区在线观看免费播放| 亚洲一级黄色| 欧美在线一二三| 国产情人节一区| 欧美在线免费观看亚洲| 久久精品国产亚洲aⅴ| 国产一区二区三区无遮挡| 欧美一区二区三区四区夜夜大片| 午夜精品福利电影| 99视频精品在线| 亚洲一区日本| 国产精品视屏| 欧美有码在线观看视频| 免费观看成人网| 亚洲第一天堂无码专区| 另类av导航| 亚洲欧洲精品一区二区三区波多野1战4| 亚洲国产一区二区三区在线播| 欧美成人r级一区二区三区| 在线国产精品一区| 欧美电影免费观看高清| 亚洲精品系列| 亚洲综合第一页| 国产午夜精品一区二区三区视频| 久久久国产成人精品| 欧美激情1区2区| 亚洲一本视频| 好看的亚洲午夜视频在线| 久久免费少妇高潮久久精品99| 亚洲国产精品悠悠久久琪琪| 久久久久久69| 夜色激情一区二区| 久久精品国产第一区二区三区| 欲色影视综合吧| 欧美麻豆久久久久久中文| 亚洲专区一区二区三区| 欧美大胆成人| 香蕉尹人综合在线观看| 在线观看日韩国产| 国产精品久久久久天堂| 欧美在线视频a| 亚洲国产精品视频| 国产精品福利网站| 久久在线免费观看视频| 亚洲视频日本| 亚洲国产精选| 久久亚洲精品欧美| 亚洲欧美日韩国产精品| 亚洲电影下载| 国产亚洲一区二区在线观看| 欧美激情中文字幕一区二区| 亚洲欧美视频在线| 91久久精品www人人做人人爽| 国产精品腿扒开做爽爽爽挤奶网站| 麻豆精品精华液| 欧美在线不卡视频| 亚洲一区二区视频在线观看| 欧美激情视频在线播放| 欧美在线999| 亚洲免费视频观看| 亚洲精品美女久久7777777| 国产欧美日韩亚洲精品| 亚洲电影免费观看高清完整版| 欧美在线视频一区二区三区| 亚洲视频在线看| 99re这里只有精品6| 永久555www成人免费| 国产一区二区三区免费在线观看| 国产精品99一区| 欧美色网一区二区| 欧美日韩亚洲视频| 欧美日本一道本| 欧美精品在线极品| 欧美区在线播放| 蜜臀a∨国产成人精品| 久久久99久久精品女同性| 久久国产精品黑丝| 久久精品日韩一区二区三区| 先锋影音久久久| 香蕉久久夜色精品| 亚洲无限av看| 宅男噜噜噜66一区二区| 亚洲人成网站色ww在线| 日韩视频免费在线观看| 亚洲精品一区在线观看香蕉| 影音先锋一区| 亚洲欧美日韩精品久久奇米色影视| 99精品视频免费观看| 一本色道综合亚洲| 亚洲精品视频在线播放| 99热在线精品观看| 亚洲一区美女视频在线观看免费| 一本久久综合| 亚洲欧美日韩一区在线观看| 亚洲午夜免费视频| 性欧美8khd高清极品| 一区二区久久久久久| 日韩视频第一页| 亚洲一区二区欧美日韩| 亚洲天堂男人| 久久久久国产一区二区三区四区 | 国产精品欧美日韩一区| 欧美视频在线观看视频极品| 国产麻豆精品视频| 在线观看成人网| 亚洲欧洲一区二区三区在线观看 | 欧美日韩国产成人在线| 91久久中文字幕| 欧美激情一区在线| 在线亚洲电影| 久久久青草婷婷精品综合日韩| 久久久精品2019中文字幕神马| 欧美大片国产精品| 欧美精品一区二区三区在线播放| 国产精品高潮在线| 在线电影一区| 在线亚洲精品| 麻豆精品一区二区综合av| 欧美激情日韩| 99热精品在线| 久久久久久久高潮| 欧美激情第六页| 香蕉精品999视频一区二区| 久久久噜噜噜久久| 国产精品99一区二区| 亚洲国产色一区| 亚洲免费影视| 亚洲黄色影院| 欧美一区二区大片| 欧美日韩一区二区三区在线看| 在线观看视频一区| 亚洲在线一区| 韩国福利一区| 999亚洲国产精| 欧美高清视频在线 |