Search code examples
c++mfcwininetwinhttp

compile errors w/wininet & winhttp in MFC application


Strangely I had this working before but I reinstalled my system, upgraded to w7 and now I can't seem to get this code to compile.

The problem is that I'm using winhttp.h in most of my application, but I have a simple FTP client object that I wrote using wininet.h functionality. I can't seem to get the application to compile now, no matter how/where I include which headers.

Currently I have in my stdafx.h:

#include <winhttp.h>

And in my ftp client .c

#include <wininet.h>

This compiles all objects successfully except for the FTP client object which fails with:

c:\Program Files\Microsoft Platform SDK\Include\WinInet.h(52) : warning C4005: 'BOOLAPI' : macro redefinition c:\Program Files\Microsoft Platform SDK\Include\winhttp.h(45) : see previous definition of 'BOOLAPI' c:\Program Files\Microsoft Platform SDK\Include\WinInet.h(270) : error C2143: syntax error : missing '}' before '(' c:\Program Files\Microsoft Platform SDK\Include\WinInet.h(270) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Any advice?


Solution

  • Ah got it, finally by moving the winhttp include into the cpp files and putting wininet into the ftp client header.