Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are header files necessary? [duplicate]

Possible Duplicate:
In C++ why have header files and cpp files?

Coming from a C# background, I find header files really annoying. Are they necessary even with C++11?

like image 242
Vittorio Romeo Avatar asked Sep 13 '25 10:09

Vittorio Romeo


2 Answers

C++ needs header files (and libs too) just like C# needs reference assemblies.

like image 160
C Johnson Avatar answered Sep 16 '25 01:09

C Johnson


Yes, because it's still based on C. You can answer your own question: Don't use them and try to compile without them. If you can't, then the compilers still require them.

I don't mean that as a tautology. If the language spec still calls for them, and the compilers match the spec, then it'd be a massive effort to change. And the debate would take a very long time. This sounds like a question that is meant for little more than venting and debate with no real end.

like image 26
duffymo Avatar answered Sep 16 '25 03:09

duffymo