Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Quick question on C++ compilers

  1. Oct 5, 2009 #1
    Is it true that most, if not all, C++ compilers tend to compile the same .h files over and over again? Say there are two .cpp files that include the same .h file, and the compiler processes one of these .cpp files & all its included header files as well. Once it gets to the second .cpp file, it doesn't recognize that it has seen the one .h file before, and so it just processes that file again, right?
     
  2. jcsd
  3. Oct 5, 2009 #2

    Borek

    User Avatar

    Staff: Mentor

    Not necesarrilly. Visual compilers (Microsoft) prepare something they call precompiled header to save on resources/compilation time. I suppose other compilers are able to do the same.
     
  4. Oct 5, 2009 #3
    Oh, I see. Although I guess it makes more sense to use precompiled headers, isn't it possible to turn that feature off (I guess it depends on the compiler)?
     
  5. Oct 6, 2009 #4

    Borek

    User Avatar

    Staff: Mentor

    On/off, as you wish.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Quick question on C++ compilers
  1. C++ compilers (Replies: 24)

Loading...