On Sat, 16 Dec 2006, Bo Persson wrote:
ajlu wrote:
>Hi all,
Is it possible to compile a c++ program without header, if possible
please let me know in detail...
***ajlu***
It is possible only if the entire program resides in one file.
This is not true. For example:
// a.cpp
extern int get_return_code(void);
int main()
{
int rc = get_return_code();
return rc;
}
//---------------
//b.cpp
int get_return_code(void)
{
return 0;
}
//---------------------------------------------------
If you want
to refer to anything outside your own code, you have to include the
appropriate headers.
Now I agree that programming the way I showed above is extremely bad
practice, and should be avoided by all means. The correct solution is of
course using header files.
Emil
>
Bo Persson