更改为win下跨平台的程序
2021-01-03 06:28
标签:rar cmake false || user 平台 addition sas ted #include 更改为win下跨平台的程序 标签:rar cmake false || user 平台 addition sas ted 原文地址:https://www.cnblogs.com/xpylovely/p/13207345.html#ifdef _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
int connectCount = 0;
struct sockaddr_in RecvIndexAddr;
int nNetTimeout= 3000;
wVersionRequested = MAKEWORD(2,2);
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we couldn‘t find a usable */
/* WinSock DLL. */
return FALSE;
}
/* Confirm that the WinSock DLL supports 2.0.*/
/* Note that if the DLL supports versions greater */
/* than 2.0 in addition to 2.0, it will still return */
/* 2.0 in wVersion since that is the version we */
/* requested. */
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
/* Tell the user that we couldn‘t find a usable */
/* WinSock DLL. */
WSACleanup();
return FALSE;
}
#endif
CmakeLists.txt 添加 link_libraries(-lws2_32)
上一篇:C#基础 Lambda