Thread: #include <windows.h> and #include <wininet.h>

  1. #1
    UK2
    Join Date
    Sep 2003
    Posts
    112

    #include <windows.h> and #include <wininet.h>

    Hello,

    VS c++ 2008

    I am creating a http client application.

    In doing some research I found that I have to include the wininet.h library into my application. I did this and when I compiled I got 283 errors.

    However, I included the header <windows.h> and all thoughs error disppeared.

    I guess that the wininet.h has dependances in the windows.h? And anyone correct if I am wrong about this.

    Another thing, can't I include my headers like this:
    #include <windows>
    #include <wininet>

    As I am writing a programming in C++ I thought I could do away with the .h extensions?

    Many thanks,

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    As I am writing a programming in C++ I thought I could do away with the .h extensions?
    No you cannot
    C++ comes with set of headers that name has no extention, they should be included as

    Code:
    #include <vector>
    other headers have extention - so you should use the corect name like
    Code:
    #include <windows.h>
    #include "my_very_special_header.hpp"
    etc
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, what vart says is correct. The reason for that is that some header files in C++ have exactly the same name as the ones in C, e.g. string - so to differentiate the C header file string.h from the STL string class file, the latter has no .h on the end.

    Including <string.h> gives you a quite different set of stuff than <string>, and in some cases you may even want both at the same time.

    So all STL headers have no .h [older ones, say in Turbo C do have for example iostream.h, but those are not in the C++ standard set].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    1
    can u send me windows.h to <[email protected]> or post link here pls.
    i need to play music using c++. can u help me

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Download the Windows SDK. You will get your heads & all other necessary files.
    As for networking, may I suggest taking a look at Boost Asio? Perhaps it might just contain some of what you need.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to use this part of dirent.h
    By kermit in forum Linux Programming
    Replies: 2
    Last Post: 01-31-2009, 08:51 AM
  2. 2d game
    By JordanCason in forum Game Programming
    Replies: 5
    Last Post: 12-08-2007, 10:08 PM
  3. MFC include BS
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 10-31-2005, 12:44 PM
  4. Function reference problems
    By Inquirer in forum C++ Programming
    Replies: 2
    Last Post: 05-07-2003, 09:03 AM
  5. help with finding lowest number entered
    By volk in forum C++ Programming
    Replies: 12
    Last Post: 03-22-2003, 01:21 PM