Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

18
  • 12
    This question could go a couple of ways .. "Why do we need headers when using c++" or, "Do you think a modern language that is meant to be compiled should be using headers?" As it is, it has 'What do I do" and "hate" in the title, which sets off a plethora of flags. Commented Jan 10, 2011 at 16:29
  • 8
    Your question makes it seem like you don't understand C++, or how whatever system you use compiles it. Learn to use it properly, and then ask more subjective questions. Commented Jan 10, 2011 at 16:35
  • 39
    Your first sentence indicates that you don't "understand everything about headers". Including a .h file does not cause the corresponding .cpp file to be "somehow compiled too". You compile .cpp files independently in their own right. If you haven't compiled the corresponding .cpp, then the inclusion of a header without a corresponding object file will cause the linker to fail. Commented Jan 10, 2011 at 17:50
  • 6
    What to do? Find another language if it bugs you that much. Commented Jan 10, 2011 at 19:23
  • 5
    About the "can't live with copy-pasting": Whenever one updates a function, one has to update all places where it is called anyway. As the callers are much harder to find than the declaration in the header file, updating the header is just a minor detail. Commented Jan 10, 2011 at 22:53