Page 1 of 1

automatic header inclusion

Posted: Sat Nov 01, 2003 8:26 pm
by rajorshi
hello all,
i use gcc 3.2.2 on my slackware system. The problem is
when is use functions in C++ programs, say assert()
the compiler does not complain even if i do not include
the header file. (there must be some auto header
inclusion going on). However because of this silly
reason i often get a compile error.
can i turn off this automatic header inclusion
so that the compiler flags errors ?
thanks in advance

Posted: Sun Nov 02, 2003 6:28 pm
by Carthage
Try renaming your files with a .CPP extension. I don't know about gcc, but in Borland compilers, they use the file extension to determine what type of action to take with the file. They aren't so strict with a .C file, but Borland compilers require that you explicity #include the right header files in .CPP files.


Posted: Sun Nov 02, 2003 7:50 pm
by rajorshi
But i am using a cpp extension!

Posted: Sun Nov 02, 2003 7:58 pm
by Carthage
Ummm, can you force the compiler to do a strict C++ compile?? I think there should be an option...

Posted: Thu Jan 29, 2004 12:19 am
by Farqaleet
try using g++ rather than gcc