Sunday, August 2, 2009

Is there any version of c++ compiler in which there is no need of including header files in a program?

Header files are necessary to declare any classes or functions that you will be using in your program. Without them, you would have to write your own base code to handle simple things like reading a file from the hard drive. Any compiler would need the header files for the functionality you are using, or else they would not know what any of the function calls you use actually mean.





Kernel compilers do not require header files, but anyone who knows enough to be working with a kernel compiler would not be asking this question on Yahoo Answers.

Is there any version of c++ compiler in which there is no need of including header files in a program?
No. There is a good reason header files are needed.





Header files allow you to include only the code segments you need to make your program work, without introducing extra code that you do not need, thus bloating the compile.
Reply:yes. the GCC compilers all are able to do that with a couple of command line options. In fact, gcc is used to write operating systems like the Linux kernel, which cannot make use of header files because it is a kernel.
Reply:There isn't any need to include header files. Just manually declare and define all constants and inlines as needed. Of course, that would be a real pain, for which the solution would be... headers.

magnolia

No comments:

Post a Comment