orca-zhang / influxdb-cpp

💜 C++ client for InfluxDB.
MIT License
163 stars 83 forks source link

Got C4996 problem when using it into my project #23

Open wzf-cn opened 4 years ago

wzf-cn commented 4 years ago

Hi, The example could be run correctly along in a project. But when I include this code into my project, the error came out.

c4996 'inet_addr':Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings

I had followed the solution in the stackoverflow, included the "Ws2tcpip.h" and changed the line 127 and line 205 in the influxdb.hpp as follows, then the program returned -3.

// For line 127
InetPton(AF_INET, (PCWSTR)(host.c_str()), &addr.sin_addr.s_addr);
if (addr.sin_addr.s_addr == INADDR_NONE) return -1;
// For line 205
InetPton(AF_INET, (PCWSTR)(si.host_.c_str()), &addr.sin_addr.s_addr);
if (addr.sin_addr.s_addr == INADDR_NONE) return -1;