Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deprecated commands in Visual C++

When building a solution in Visual Studio 2013 of a project, I noticed that I am getting warnings for the following references:

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

Whenever I try to change it to the recommended IntelliSense command, it is saying:

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

like image 456
User2025 Avatar asked Oct 24 '25 14:10

User2025


1 Answers

These errors are telling you what to do. Microsoft is nice like that.

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

As far as GetVersionExW and GetVersion Microsoft recommends using the appropriate Version Helper Function.

like image 99
Jonathan Mee Avatar answered Oct 26 '25 08:10

Jonathan Mee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!