C++ HINTERNET variable type

Status
Not open for further replies.
I need a little help with the HINTERNET variable type. I am trying to work with some functions that deal with the wininet libraries. I define and include of wininet.h. I try to compile the file even with no other lines of code(comment all out) and it still fails. The compile errors i am getting are with the wininet.h header file. It states that a ';' is missing after the HINTERNET variable definition. It also states that there is an unusual end of file on the same line. I have tried it on 2 different installs of visual studio to ensure it wasn't a corrupted file. Please help. Here is a small sample.

#include "wininet.h"

void main()
{
HINTERNET hOpen;

printf("test");
}

Thanks,
Inferno
 

earl

Well-known member
3,066
I hit this too:
include windows.h *before* you include wininet.h. Why do you have to do this? Dunno, but it works. LPVOID might not be declared otherwise if I was to hazard a guess.

Other stuff you can try:

  • did you include Wininet.lib as a library in the compile command line? You have to do that as well as include the wininet.h header
  • right click on HINTERNET and choose definition. It may say you have to rebuild to generate browse information; say OK. See if it can find the definition; if it can't, then you are including the wrong headers
  • check if wininet stuff depends on MFC; if so, you have to include it in your project as well


-earl-
 
Status
Not open for further replies.