簡體   English   中英

WINVER,Winsock和Htonl()

[英]WINVER, winsock and htonl()

當我不定義WINVER時,我的(msvc9)構建中充滿了警告,並說它的默認值為0x0600(Vista),但它構建良好。 當我定義WINVER = 0x501(XP)時,出現此錯誤:-

error C3861: 'htonl': identifier not found

我寧願使用WINVER = 0x0501而不是0x0600,但我不知道如何解決它!

我在http://west-chamber-season-2.googlecode.com/svn-history/r2/trunk/wcs2_cli.c中注意到了一些東西

#ifdef WINVER
#include <winsock.h>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

我需要做一些奇怪的事情嗎? 有任何想法嗎?

如果要針對Windows進行編譯,則#include winsock2.h和ws2tcpip.h並鏈接到ws2_32.lib。 在嘗試任何網絡功能之前,還請確保先致電WSAStartup

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM