wininet.h error

This is a discussion on wininet.h error within the C++ Programming forums, part of the General Programming Boards category; I was trying to build a patcher program which would download files via ftp server. Everything seems to be working ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    4

    wininet.h error

    I was trying to build a patcher program which would download files via ftp server. Everything seems to be working fine except i get an error when i complile

    Code:
    Compiling resources...
    Compiling...
    StdAfx.cpp
    c:\program files\microsoft visual studio\vc98\include\wininet.h(48) : error C2146: syntax error : missing ';' before identifier 'HINTERNET'
    c:\program files\microsoft visual studio\vc98\include\wininet.h(48) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.
    
    ftptest.exe - 2 error(s), 0 warning(s)
    This would seem like an easy error to fix but there is no missing ';' before the identifier and the second error is just part of that i'm guessing.

    I was looking around on the internet about this and i found its probly an error with wininet.h not being precompiled. AfxDisp.h is #included in StdAfx.h and it #includes the wininet.h file which has not been compiled yet. I went to the preprocessor command in Project settings under C/C++. I added " ,wininet.h" to the precompiled headers.

    That didnt solve my problem so i went into StdAfx.h and added #include wininet.h to the file before afxdisp.h like this...

    Code:
    ...
    #include <wininet.h>
    #include <afxwin.h>         // MFC core and standard components
    #include <afxext.h>         // MFC extensions
    #include <afxdisp.h>        // MFC Automation classes
    #include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Co
    ...
    That still did not work. Does anyone know what could be the problem i never expected something to be wrong with the msdn library files hehe. If you can help me thanks in advance if not sorry to bother your time.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I think you should #include <windows.h> first.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    4
    Well thanks for trying i just put it in the afxstd.h file like this and it didnt work not sure if thats what you ment.

    Code:
    ...
    #include <windows.h>
    #include <wininet.h>
    #include <afxwin.h>         // MFC core and standard components
    #include <afxext.h>         // MFC extensions
    #include <afxdisp.h>        // MFC Automation classes
    #include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
    ...
    same error

  4. #4
    C++ beginner
    Join Date
    Jun 2004
    Posts
    66
    Chances are your missing semi clen is somewhere else in your code, not directly infront of what it says it's in front of.
    Oh my goodness.

  5. #5
    Registered User
    Join Date
    Jun 2004
    Posts
    4
    It would then be in that file would it not? That file is from the msdn library highly likely they have an error in it. I looked breifly in hte file didnt see anything that would be wrong aout the syntax. However that was my first thought also. Seeing as thats what the error says hehe.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,649
    It says that because it doesn't know what LPVOID is - which is corrected by including windows.h before it or putting wininet.h after everything else.

    gg

  7. #7
    Registered User
    Join Date
    Jun 2004
    Posts
    4
    Hum that seemed to help came up with a couple other errors too of hte same type but i should be able to fix those the same way thanks alot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21