gpt4 book ai didi

c++ - Visual C++ 中弃用的命令

转载 作者:行者123 更新时间:2023-11-30 02:42:35 25 4
gpt4 key购买 nike

在项目的 Visual Studio 2013 中构建解决方案时,我注意到我收到以下引用的警告:

warning C4996: 'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings src\core\JCSocket.cpp 77 1
warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings src\core\JCSocket.cpp 82 1
warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings src\core\JCSocket.cpp 121 1
warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings src\core\MuninNodeServer.cpp 64 1
warning C4996: 'GetVersionExW': was declared deprecated src\plugins\disk\DiskTimeMuninNodePlugin.cpp 48 1
warning C4996: 'GetVersion': was declared deprecated src\plugins\external\ConsolePipe.cpp 12 1
warning C4996: 'GetVersionExW': was declared deprecated src\plugins\PerfCounterMuninNodePlugin.cpp 56 1
warning C4996: 'GetVersionExW': was declared deprecated src\plugins\uptime\UptimeMuninNodePlugin.cpp 34 1

每当我尝试将其更改为推荐的 IntelliSense 命令时,它都会说:

IntelliSense: identifier "inet_ntop" is undefined \src\core\MuninNodeServer.cpp 64 31

最佳答案

这些错误告诉您该怎么做。微软就是这样。

gethostbyname -> getaddrinfo
inet_addr -> inet_pton
inet_ntoa -> inet_ntop

GetVersionExWGetVersion 而言,Microsoft 建议使用适当的 Version Helper Function .

关于c++ - Visual C++ 中弃用的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26947496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com