automatic header inclusion

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
rajorshi
New poster
Posts: 3
Joined: Sat Nov 01, 2003 8:20 pm
Contact:

automatic header inclusion

Post 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
Long Live GNU!
Carthage
New poster
Posts: 12
Joined: Wed Oct 29, 2003 8:05 pm

Post 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.
My ideas on solving programming problems are 91% common sense, practicality and luck, 8% pure knowledge, and 1% extreme Math.
rajorshi
New poster
Posts: 3
Joined: Sat Nov 01, 2003 8:20 pm
Contact:

but...

Post by rajorshi »

But i am using a cpp extension!
Long Live GNU!
Carthage
New poster
Posts: 12
Joined: Wed Oct 29, 2003 8:05 pm

Post by Carthage »

Ummm, can you force the compiler to do a strict C++ compile?? I think there should be an option...
My ideas on solving programming problems are 91% common sense, practicality and luck, 8% pure knowledge, and 1% extreme Math.
Farqaleet
New poster
Posts: 15
Joined: Wed Jan 28, 2004 11:24 pm

Post by Farqaleet »

try using g++ rather than gcc
Post Reply

Return to “C++”