Board index » cppbuilder » Limitations considering the size of a header file

Limitations considering the size of a header file

Hi,

if the header file of my TLabel's derived class, covering several
intermediate classes, becomes longer than 400 lines (exactly 402), I
get, when compiling, the error message "unexpected end of file in
conditional started at line 3". Are there any limitations concerning the
size of a header file? Is it possible that any further header files
included in the header file are taken into consideration? If that is the
case, how can I handle this problems? I am using BCB4 Enterprise Edition.

Many thanks for every possible help.

 

Re:Limitations considering the size of a header file


This message is normally given if you have an #if xxx without a matching
#endif
You should check that all #ifs are matched - see the lin number mentioned
for the starting #if
HTH Pete
GenHelp: The Component Writers Help Authoring package
Team Thai Kingdom
=================================
Web:  www.frasersoft.net

Quote
"Martin Rupprecht" <mruppre...@softec.de> wrote in message

news:3CB40547.4010609@softec.de...
Quote
> Hi,

> if the header file of my TLabel's derived class, covering several
> intermediate classes, becomes longer than 400 lines (exactly 402), I
> get, when compiling, the error message "unexpected end of file in
> conditional started at line 3". Are there any limitations concerning the
> size of a header file? Is it possible that any further header files
> included in the header file are taken into consideration? If that is the
> case, how can I handle this problems? I am using BCB4 Enterprise Edition.

> Many thanks for every possible help.

Re:Limitations considering the size of a header file


Hi Pete,

you are right. But there is a matching #endif at the end of my header
file like in the example below.

//---------------------------------------------------------------------------
// Borland C++Builder
// Copyright (c) 1987, 1998 Borland International Inc.  All Rights Reserved.
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef auto1H
#define auto1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
         TEdit *Edit1;
private:        // User declarations
public:         // User declarations
         __fastcall TForm1(TComponent* Owner);

Quote
};

//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

In my case, when the number of lines between #ifndef and #endif exceeds
400, the error occurs (its the same if I insert comments or code, but
empty rows (return only) don't cause the error). Whenn I delete enough
lines between #ifndef and #endif and compile again, the error disappears.

Martin

Quote
Pete Fraser wrote:
> This message is normally given if you have an #if xxx without a matching
> #endif
> You should check that all #ifs are matched - see the lin number mentioned
> for the starting #if
> HTH Pete
> GenHelp: The Component Writers Help Authoring package
> Team Thai Kingdom
> =================================
> Web:  www.frasersoft.net

> "Martin Rupprecht" <mruppre...@softec.de> wrote in message
> news:3CB40547.4010609@softec.de...

>>Hi,

>>if the header file of my TLabel's derived class, covering several
>>intermediate classes, becomes longer than 400 lines (exactly 402), I
>>get, when compiling, the error message "unexpected end of file in
>>conditional started at line 3". Are there any limitations concerning the
>>size of a header file? Is it possible that any further header files
>>included in the header file are taken into consideration? If that is the
>>case, how can I handle this problems? I am using BCB4 Enterprise Edition.

>>Many thanks for every possible help.

Re:Limitations considering the size of a header file


I have an include file of 900 lines that works OK so I guess it's a problem
with your file.
Do your files have CRLFs in them or are they just LF (like unix) Borland
used to have problems with this.
HTH Pete

Quote
"Martin Rupprecht" <mruppre...@softec.de> wrote in message

news:3CB42AA6.5000305@softec.de...
Quote
> Hi Pete,

> you are right. But there is a matching #endif at the end of my header
> file like in the example below.

//--------------------------------------------------------------------------
-
Quote
> // Borland C++Builder
> // Copyright (c) 1987, 1998 Borland International Inc.  All Rights
Reserved.

//--------------------------------------------------------------------------
-
Quote

//--------------------------------------------------------------------------
-
Quote
> #ifndef auto1H
> #define auto1H

//--------------------------------------------------------------------------
-
Quote
> #include <Classes.hpp>
> #include <Controls.hpp>
> #include <StdCtrls.hpp>
> #include <Forms.hpp>

//--------------------------------------------------------------------------
-
Quote
> class TForm1 : public TForm
> {
> __published:    // IDE-managed Components
>          TEdit *Edit1;
> private:        // User declarations
> public:         // User declarations
>          __fastcall TForm1(TComponent* Owner);
> };

//--------------------------------------------------------------------------
-
Quote
> extern PACKAGE TForm1 *Form1;

//--------------------------------------------------------------------------
-
Quote
> #endif

> In my case, when the number of lines between #ifndef and #endif exceeds
> 400, the error occurs (its the same if I insert comments or code, but
> empty rows (return only) don't cause the error). Whenn I delete enough
> lines between #ifndef and #endif and compile again, the error disappears.

> Martin

> Pete Fraser wrote:

> > This message is normally given if you have an #if xxx without a matching
> > #endif
> > You should check that all #ifs are matched - see the lin number
mentioned
> > for the starting #if
> > HTH Pete
> > GenHelp: The Component Writers Help Authoring package
> > Team Thai Kingdom
> > =================================
> > Web:  www.frasersoft.net

> > "Martin Rupprecht" <mruppre...@softec.de> wrote in message
> > news:3CB40547.4010609@softec.de...

> >>Hi,

> >>if the header file of my TLabel's derived class, covering several
> >>intermediate classes, becomes longer than 400 lines (exactly 402), I
> >>get, when compiling, the error message "unexpected end of file in
> >>conditional started at line 3". Are there any limitations concerning the
> >>size of a header file? Is it possible that any further header files
> >>included in the header file are taken into consideration? If that is the
> >>case, how can I handle this problems? I am using BCB4 Enterprise
Edition.

> >>Many thanks for every possible help.

Re:Limitations considering the size of a header file


I'am working with Win 98SE so I think the file has CRLFs in it.

Martin

Quote
Pete Fraser wrote:
> I have an include file of 900 lines that works OK so I guess it's a problem
> with your file.
> Do your files have CRLFs in them or are they just LF (like unix) Borland
> used to have problems with this.
> HTH Pete

> "Martin Rupprecht" <mruppre...@softec.de> wrote in message
> news:3CB42AA6.5000305@softec.de...

>>Hi Pete,

>>you are right. But there is a matching #endif at the end of my header
>>file like in the example below.

> //--------------------------------------------------------------------------
> -

>>// Borland C++Builder
>>// Copyright (c) 1987, 1998 Borland International Inc.  All Rights

> Reserved.

> //--------------------------------------------------------------------------
> -

> //--------------------------------------------------------------------------
> -

>>#ifndef auto1H
>>#define auto1H

> //--------------------------------------------------------------------------
> -

>>#include <Classes.hpp>
>>#include <Controls.hpp>
>>#include <StdCtrls.hpp>
>>#include <Forms.hpp>

> //--------------------------------------------------------------------------
> -

>>class TForm1 : public TForm
>>{
>>__published:    // IDE-managed Components
>>         TEdit *Edit1;
>>private:        // User declarations
>>public:         // User declarations
>>         __fastcall TForm1(TComponent* Owner);
>>};

> //--------------------------------------------------------------------------
> -

>>extern PACKAGE TForm1 *Form1;

> //--------------------------------------------------------------------------
> -

>>#endif

>>In my case, when the number of lines between #ifndef and #endif exceeds
>>400, the error occurs (its the same if I insert comments or code, but
>>empty rows (return only) don't cause the error). Whenn I delete enough
>>lines between #ifndef and #endif and compile again, the error disappears.

>>Martin

>>Pete Fraser wrote:

>>>This message is normally given if you have an #if xxx without a matching
>>>#endif
>>>You should check that all #ifs are matched - see the lin number

> mentioned

>>>for the starting #if
>>>HTH Pete
>>>GenHelp: The Component Writers Help Authoring package
>>>Team Thai Kingdom
>>>=================================
>>>Web:  www.frasersoft.net

>>>"Martin Rupprecht" <mruppre...@softec.de> wrote in message
>>>news:3CB40547.4010609@softec.de...

>>>>Hi,

>>>>if the header file of my TLabel's derived class, covering several
>>>>intermediate classes, becomes longer than 400 lines (exactly 402), I
>>>>get, when compiling, the error message "unexpected end of file in
>>>>conditional started at line 3". Are there any limitations concerning the
>>>>size of a header file? Is it possible that any further header files
>>>>included in the header file are taken into consideration? If that is the
>>>>case, how can I handle this problems? I am using BCB4 Enterprise

> Edition.

>>>>Many thanks for every possible help.

Re:Limitations considering the size of a header file


Just for the record, if you import the Excel ActiveX control the header file
is some 10Mb!!

Martin.

"Martin Rupprecht" <mruppre...@softec.de> escribi en el mensaje
news:3CB40547.4010609@softec.de...

Quote
> Hi,

> if the header file of my TLabel's derived class, covering several
> intermediate classes, becomes longer than 400 lines (exactly 402), I
> get, when compiling, the error message "unexpected end of file in
> conditional started at line 3". Are there any limitations concerning the
> size of a header file? Is it possible that any further header files
> included in the header file are taken into consideration? If that is the
> case, how can I handle this problems? I am using BCB4 Enterprise Edition.

> Many thanks for every possible help.

Re:Limitations considering the size of a header file


Hi,

Quote
> get, when compiling, the error message "unexpected end of file in
> conditional started at line 3". Are there any limitations concerning the

There was BCB4 bug that, when a header included itself, was a certain
size, and was open in the IDE edit buffer, then due to the way that
chunks of the edit buffer were handed to the compiler, then the
conditional defining the header sentinel would not be seen correctly
and there would be infinite self-inclusion of the header. Workaround
would be to close the header from the Code Editor. Or I *think* adding
some blocks of single-line comments might help. Or avoid the recursive
inclusion of the header.

--Craig

Re:Limitations considering the size of a header file


Hi Craig,

you are right, in the header there is a self-inclusion. Originally I
thought that #ifndef...#endif are exactly existing to avoid an endless
integration. Well, now I have to think over a way to bypass the problem.
Tere are many classes in my project, of which every class should know
every class (any hint how to do that?)

Thanks

Martin

Quote
Craig Farrell wrote:
> Hi,

>>get, when compiling, the error message "unexpected end of file in
>>conditional started at line 3". Are there any limitations concerning the

> There was BCB4 bug that, when a header included itself, was a certain
> size, and was open in the IDE edit buffer, then due to the way that
> chunks of the edit buffer were handed to the compiler, then the
> conditional defining the header sentinel would not be seen correctly
> and there would be infinite self-inclusion of the header. Workaround
> would be to close the header from the Code Editor. Or I *think* adding
> some blocks of single-line comments might help. Or avoid the recursive
> inclusion of the header.

> --Craig

Other Threads