I'm getting a couple errors when attempting to compile a DLL for use in a program that will run on Windows XP. They are both similar: 'GetAddrInfo: identifier not found', and 'FreeAddrInfo: identifier not found'. I'm limited in what I can do (I must modify existing code that hasn't been updated since 2012. I'm a co-op, so my degree in computer science is not yet complete, and I may not know certain things). I'm using MFC in a static library. My platform toolset is Visual Studio 2013 - Windows XP (v120_xp). I am using Microsoft Visual Studio Professional 2013. My StdAfx.h includes the following code:
#ifndef WINVER #define WINVER 0x0501 #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0501 #endif #define VC_EXTRALEAN //... #include <WinSock2.h>
The Foo.cpp file I'm getting the error from includes the following headers:
#include "stdafx.h" #include <stdio.h> #include <WinIoctl.h> #include <process.h> #include <Windows.h> #include <MMSystem.h> #include <Mstcpip.h> #include <WS2tcpip.h>
My version of WS2tcpip.h is from the Windows 7.1A SDK. If I open it, I can see that GetAddrInfo() and FreeAddrInfo() are defined, but for whatever reason, VS2013 is not finding those definitions (though it can find the header file itself and has no trouble including them).
Additional note: if I change the #defines in StdAfx.h to:
#define WINVER 0x0600 #define _WIN32_WINNT 0x0600
and use the regular Visual Studio 2013 toolset, I have no problems compiling the DLL. Unfortunately, the DLL must work with Windows XP. I've been unable to find any information about why this might be. Could my includes be in the wrong place?