| View previous topic :: View next topic |
| Author |
Message |
Peter Sprenger Guest
|
Posted: Wed May 09, 2007 8:10 am Post subject: precompiled header problem in BDS2006, any solution? |
|
|
I switched from BCB6 to BDS2006 and have again the problem, that I
cannot use precompiled headers, when math.h or a header file that has
"initialized data in header" is included before pragma hdrstop.
Has anybody found a convenient way to get around this? I think CG will
not change anything in the upcoming BDS2007.
Regards,
Peter |
|
| Back to top |
|
 |
Leo Siefert Guest
|
Posted: Wed May 09, 2007 5:00 pm Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
Peter Sprenger wrote:
| Quote: | Has anybody found a convenient way to get around this?
|
Well, the obvious answer would be to put math.h after the hdrstop
pragma. The compile time for math.h is a drop in the bucket compared
to the VCL and Windows headers you are probably including in your BCB
projects.
| Quote: | I think CG will not change anything in the upcoming BDS2007.
|
If they don't then I don't expect anyone will upgrade.
- Leo |
|
| Back to top |
|
 |
Peter Sprenger Guest
|
Posted: Wed May 09, 2007 6:55 pm Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
| Quote: | Has anybody found a convenient way to get around this?
Well, the obvious answer would be to put math.h after the hdrstop
pragma. The compile time for math.h is a drop in the bucket compared
to the VCL and Windows headers you are probably including in your BCB
projects.
As obvious as it gets, math.h is included in many ways from other header |
files. Of course I can try to detect the lines that offend the
precompilation, put it in my "math2.h" and include this file after
pragma hdrstop. After 1 hour wasted for this, I can still try to find a
solution for the other "offending" header files.
This is NOT convenient, and has possibly to be redone for BDS2007.
| Quote: | I think CG will not change anything in the upcoming BDS2007.
If they don't then I don't expect anyone will upgrade.
What a shame. |
|
|
| Back to top |
|
 |
David Dean [CodeGear] Guest
|
Posted: Wed May 09, 2007 10:50 pm Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
In article <f1rrp1$t5l$1 (AT) bolzen (DOT) all.de>,
Peter Sprenger <info (AT) gudeads (DOT) com> wrote:
| Quote: | Has anybody found a convenient way to get around this? I think CG will
not change anything in the upcoming BDS2007.
|
This is something I am very interested in. All the test cases I have
seen so far boil down to including math.hpp, so If you don't include
this file, but still see the warning, I'd like to see the test case.
--
-David Dean
CodeGear C++ QA Engineer
<http://blogs.codegear.com/ddean/> |
|
| Back to top |
|
 |
Duane Hebert Guest
|
Posted: Thu May 10, 2007 12:12 am Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
"David Dean [CodeGear]" <david.dean.no (AT) spam (DOT) codegear.com> wrote in message
news:david.dean.no-2B3868.10504309052007 (AT) killface (DOT) local...
| Quote: | In article <f1rrp1$t5l$1 (AT) bolzen (DOT) all.de>,
Peter Sprenger <info (AT) gudeads (DOT) com> wrote:
Has anybody found a convenient way to get around this? I think CG will
not change anything in the upcoming BDS2007.
This is something I am very interested in. All the test cases I have
seen so far boil down to including math.hpp, so If you don't include
this file, but still see the warning, I'd like to see the test case.
|
I think that if you have default variables assigned to functions in
header files you'll get the same problem. This may have been
intermittent IIRC and it also showed up as a complaint about
dialogs.hpp is some cases.
But basically something like:
class doh {
void spoo(int x = 42);
};
would cause problems. We would basically
watch the compiler until it generated this message
and then try to figure out what it was compiling at
the time. I have BDS explorer at home. If I have a
chance, I'll try to generate a test case. |
|
| Back to top |
|
 |
David Dean [CodeGear] Guest
|
Posted: Thu May 10, 2007 5:49 am Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
In article <46421d09$1 (AT) newsgroups (DOT) borland.com>,
"Duane Hebert" <spoo (AT) flarn (DOT) com> wrote:
| Quote: | I think that if you have default variables assigned to functions in
header files you'll get the same problem.
|
I'm sorry if I wasn't specific enough. I'm looking for examples of
this that occur in headers that we provide. The compiler is going to
bail on generating PCH if it catches actual initialized data. (IOW,
don't do this on purpose)
--
-David Dean
CodeGear C++ QA Engineer
<http://blogs.codegear.com/ddean/> |
|
| Back to top |
|
 |
Duane Hebert Guest
|
Posted: Thu May 10, 2007 6:03 am Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
"David Dean [CodeGear]" <david.dean.no (AT) spam (DOT) codegear.com> wrote in message
news:david.dean.no-018BF3.17492009052007 (AT) killface (DOT) local...
| Quote: | In article <46421d09$1 (AT) newsgroups (DOT) borland.com>,
"Duane Hebert" <spoo (AT) flarn (DOT) com> wrote:
I think that if you have default variables assigned to functions in
header files you'll get the same problem.
I'm sorry if I wasn't specific enough. I'm looking for examples of
this that occur in headers that we provide. The compiler is going to
bail on generating PCH if it catches actual initialized data. (IOW,
don't do this on purpose)
|
Ok. Then it's intentional that you can't pre-compiled
code with default args?
In that case, the only ones that I know of have to do
with math.hpp. |
|
| Back to top |
|
 |
David Dean [CodeGear] Guest
|
Posted: Thu May 10, 2007 8:11 am Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
In article <46426f56$1 (AT) newsgroups (DOT) borland.com>,
"Duane Hebert" <spoo (AT) flarn2 (DOT) com> wrote:
| Quote: | Ok. Then it's intentional that you can't pre-compiled
code with default args?
|
There is a feature request in to handle it, in the meantime, I want
to try to see what else we can do.
--
-David Dean
CodeGear C++ QA Engineer
<http://blogs.codegear.com/ddean/> |
|
| Back to top |
|
 |
David Perkins Guest
|
Posted: Thu May 10, 2007 2:19 pm Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
| Quote: | Ok. Then it's intentional that you can't pre-compiled
code with default args?
|
You sure that's right? I use PCH on all my projects and the only time I
get a problem is when a third-party component includes math.hpp or
dialog.hpp. My use of default args doesn't break the PCH. |
|
| Back to top |
|
 |
Darko Miletic Guest
|
Posted: Thu May 10, 2007 6:22 pm Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
David Perkins <please@no-spam.com> wrote:
| Quote: | Ok. Then it's intentional that you can't pre-compiled
code with default args?
You sure that's right? I use PCH on all my projects and the only time I
get a problem is when a third-party component includes math.hpp or
dialog.hpp. My use of default args doesn't break the PCH.
|
You are right. I tried reproducing this error with custom header. Any common class with wethods that have default value pass ok.
What generates problem is placing variable in header and assigning it some value like this:
int test = 123; //fails for pch
const int test2 = 123; //everything is fine
Here is the header:
#ifndef STHDR
#define STHDR
int test = 123;
const int test2 = 123;
struct ttt {
void SomeMethod (int p = 0) {}
void SomeOtherMethod (const int p = 0) {}
};
void stest (int d, const char* = 0);
#endif /*STHDR*/ |
|
| Back to top |
|
 |
Bob Gonder Guest
|
Posted: Thu May 10, 2007 7:50 pm Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
Darko Miletic wrote:
| Quote: | You are right. I tried reproducing this error with custom header. Any common class with wethods that have default value pass ok.
|
What about inline functions?
Math.h has many inline functions.
I would think if out-of-line inline functions is enabled, that the
header would emit.
(Or if the compiler otherwise decided to out-of-line the functions.) |
|
| Back to top |
|
 |
Duane Hebert Guest
|
Posted: Thu May 10, 2007 8:02 pm Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
| Quote: | You are right. I tried reproducing this error with custom header. Any
common class with wethods that have default value pass ok.
|
Unfortunately it's not consistent. What we've seen is that we'll start
getting warnings that
precompiling has stopped due to code in header of dialogs.hpp. This will be
where no
dialogs.hpp is used. We would watch the compilation until the error popped
up, diagnose the
includes and move them after the pragma hdrstop until the error went away.
Very time consuming.
Eventually and in every case we found that the culprit was a class that have
a function with a
default value.
As I said before, I could never create a test project to duplicate this but
I have seen other
people post similar complaints. I have the impression that David Dean knows
something
about it since he said it was a request to change this.
At any rate, what we ended up doing is to just precompile vcl.h. Reduced
efficiency but
works to some extent.
| Quote: | What generates problem is placing variable in header and assigning it some
value like this:
int test = 123; //fails for pch
const int test2 = 123; //everything is fine
Here is the header:
#ifndef STHDR
#define STHDR
int test = 123;
const int test2 = 123;
struct ttt {
void SomeMethod (int p = 0) {}
void SomeOtherMethod (const int p = 0) {}
};
void stest (int d, const char* = 0);
#endif /*STHDR*/
|
|
|
| Back to top |
|
 |
Leroy Casterline Guest
|
Posted: Sun May 13, 2007 1:59 am Post subject: Re: precompiled header problem in BDS2006, any solution? |
|
|
On Thu, 10 May 2007 10:19:21 +0100, David Perkins <please@no-spam.com>
wrote:
| Quote: | Ok. Then it's intentional that you can't pre-compiled
code with default args?
You sure that's right? I use PCH on all my projects and the only time I
get a problem is when a third-party component includes math.hpp or
dialog.hpp. My use of default args doesn't break the PCH.
|
It depends on the data type. Integers are OK, doubles and AnsiStrings
are not. |
|
| Back to top |
|
 |
|