 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jerker Guest
|
Posted: Wed Sep 21, 2005 12:26 pm Post subject: Unwanted include |
|
|
Hi all! The BCB include mechanism is truly a mystery to me. It seems
like the compiler includes header files that are not mentioned in any
#include directive.
Here is the beginning of my file Xml.cpp:
#pragma hdrstop
#include "Xml.h"
.... no more includes in this file
And here is the beginning of Xml.h:
#ifndef XML_H
#define XML_H
#include <sstream>
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;
.... no more includes in this file
When I compile Xml.cpp (using Alt-F9), I get a compilation error in
another header file of the project, called Utility.h. Clearly, those
five STL include files can't have any references back to Utility.h,
which I wrote myself. So why was Utility.h included in the compilation?
(You might be wondering why I just don't correct the error in
Utility.h. The problem is that there is actually nothing wrong with
Utility.h - it compiles file when used in all units that explicitly
includes it. I asked about this problem in a post a few days ago in
this forum, but have yet to find a solution.)
Using C++Builder 6 Persona,l build 10.161.
Thanks in advance!
|
|
| Back to top |
|
 |
Jerker Hammarberg Guest
|
Posted: Wed Sep 21, 2005 1:02 pm Post subject: Re: Unwanted include |
|
|
I got around the problem by explicitly including "Utility.h" before
"Xml.h" in Xml.cpp. This means that if I DON'T include a header file, I
get a compilation error in the file that I didn't include, but if I DO
include it (although it doesn't contain any declarations that I need),
it works fine. I'm still curious for an explanation to this behaviour.
/Jerker
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|