Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. about .h file

about .h file

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maer727
    wrote on last edited by
    #1

    - Sometimes I do not include certain .h file(s), but the app still runs ok. I do not know why. Are there any defaults .h file(s)? - Can you give me an example? - Best regards, Maer

    C 1 Reply Last reply
    0
    • M Maer727

      - Sometimes I do not include certain .h file(s), but the app still runs ok. I do not know why. Are there any defaults .h file(s)? - Can you give me an example? - Best regards, Maer

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      There are no default .h files, you're probably either including stuff you don't need, or you're including other headers that #include the other ones you need. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

      N 1 Reply Last reply
      0
      • C Christian Graus

        There are no default .h files, you're probably either including stuff you don't need, or you're including other headers that #include the other ones you need. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        I am not sure about this Christian, but I think some headers are auto-inserted or perhaps they are in some pre-compiled format. I use strcpy and strcmp without including string.h and I dont get errors. Nish Sonork ID 100.9786 voidmain
        www.busterboy.org
        Nish is a BIG fan of Goran Ivanisevic

        C A 2 Replies Last reply
        0
        • N Nish Nishant

          I am not sure about this Christian, but I think some headers are auto-inserted or perhaps they are in some pre-compiled format. I use strcpy and strcmp without including string.h and I dont get errors. Nish Sonork ID 100.9786 voidmain
          www.busterboy.org
          Nish is a BIG fan of Goran Ivanisevic

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          string.h is the basic_string class, I believe. strcmp and strcpy are both part of the core C++ which you get for free, i.e. without having to include any external libraries, such as stdio, iostream, list, map, etc. I'm not sure on this, but I'd say that the stuff you get for free is some sort of superset of the stuff that comes with C, and that the whole point is one of not including too much above C as default, because I know Stroustrup worked hard to make sure C++ was not much bigger or less fast than C. This is one major reason ( and the one he usually gives ) as to why there is no garbage collection built into C++. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

          N 1 Reply Last reply
          0
          • C Christian Graus

            string.h is the basic_string class, I believe. strcmp and strcpy are both part of the core C++ which you get for free, i.e. without having to include any external libraries, such as stdio, iostream, list, map, etc. I'm not sure on this, but I'd say that the stuff you get for free is some sort of superset of the stuff that comes with C, and that the whole point is one of not including too much above C as default, because I know Stroustrup worked hard to make sure C++ was not much bigger or less fast than C. This is one major reason ( and the one he usually gives ) as to why there is no garbage collection built into C++. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #5

            Thanks. I guess you are correct. Because the moment you use an API call, you need to include the required header file. I think most of the header files used by CRT functions are auto-inserted for us. Some like "process.h" need to be manually included. Regards Nish Sonork ID 100.9786 voidmain
            www.busterboy.org
            Nish is a BIG fan of Goran Ivanisevic

            1 Reply Last reply
            0
            • N Nish Nishant

              I am not sure about this Christian, but I think some headers are auto-inserted or perhaps they are in some pre-compiled format. I use strcpy and strcmp without including string.h and I dont get errors. Nish Sonork ID 100.9786 voidmain
              www.busterboy.org
              Nish is a BIG fan of Goran Ivanisevic

              A Offline
              A Offline
              Alvaro Mendez
              wrote on last edited by
              #6

              Nope, try this: - Create an "Empty" Win32 Console app. - Create a new file and add this to it:

              void main()
              {
              char abc[4];
              strcpy(abc, "abc");
              }

              - Save the file and add it to the project. - Build. You'll find that it doesn't work unless you include string.h at the top. Moral of the story: the C compiler does not include any default headers (unlike Java which always gives you the java.lang.* package). Regards, Alvaro

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups