I've reduced this code fragment as much as I can. It began as demo software for a socket client. Specifically, despite including the Ws2tcpip.h file, my compiler is still giving me the error:
test.cpp:6: error: 'getaddrinfo' was not declared in this scope
Here's the file giving the error:
1 2 3 4 5 6 7 8 9
#include<string>
#include<Ws2tcpip.h> //used instead of "Winsock2.h"
int myStartupClient(std::string ipAddress, std::string portNumber, struct addrinfo giveHints, struct addrinfo **receiveServerInfo)
{
int status = getaddrinfo(ipAddress.c_str(), portNumber.c_str(), (conststruct addrinfo *) &giveHints, receiveServerInfo);
return 0;
}
The toolchain is mingw, running on Windows 7. Any ideas what I'm doing wrong?
debug/client.o: In function `Z13startupClientSsSs8addrinfoPPS_':
C:\Users\Mike\Desktop\Client-Server\Client-Server for Windows OS\Regular Connection\client/client.cpp:137: undefined reference to `getaddrinfo@16'
Am I somehow picking up the wrong version of this routine or something? I get these errors even if I set the macro to 0x501.