在c++ Builder 6中用哪个头文件?

CHNBOX 2020-06-04 01:37:25
各位老师,我们以前有一个在C++ Builder 4上编译的软件。现在想在C++ Builder 6上进行编译,编译出现“Unable to open include file ‘classlib/arrays.h’。C++ Builder 6没有该头文件。请问在C++ Builder 6 中用哪个头文件代替,然后进行相应的修改?arrays.h头文件内容如下:
//----------------------------------------------------------------------------
// Borland BIDS Container Library
// Copyright (c) 1991, 1998 by Borland International, All Rights Reserved
//
//$Revision: 1.4 $
//
//----------------------------------------------------------------------------
#if !defined( CLASSLIB_ARRAYS_H )
#include <classlib/pre.h> /* - pre-CLASSLIB - */
#define CLASSLIB_ARRAYS_H

//#define TEMPLATES

#if !defined( CLASSLIB_DEFS_H )
# include <classlib/defs.h>
#endif
#if !defined( CLASSLIB_SHDDEL_H )
# include <classlib/shddel.h>
#endif
#if !defined( CLASSLIB_ALLOCTR_H )
# include <classlib/alloctr.h>
#endif
#if !defined( CLASSLIB_VECTIMP_H )
# include <classlib/vectimp.h>
#endif

#pragma option -Vo-
#if defined( BI_CLASSLIB_NO_po )
# pragma option -po-
#endif

#if defined(BI_NAMESPACE)
namespace ClassLib {
#endif

/*------------------------------------------------------------------------*/
/* */
/* [INTERNAL USE ONLY] */
/* */
/* template <class Vect, class T> class TArrayAsVectorImp */
/* */
/* Implements the type-independent array operations, using a vector */
/* as the underlying implementation. The type Vect specifies the */
/* form of the vector, either a TCVectorImp<T0>, a TSVectorImp<T0>, a */
/* TICVectorImp<T0>, or a TISVectorImp<T0>. The type T specifies the */
/* type of the objects to be put in the array. When using */
/* TCVectorImp<T0> or a TSVectorImp<T0> T should be the same as T0. When */
/* using TICVectorImp<T0> or TISVectorImp<T0> T should be of type */
/* pointer to T0. See TArrayAsVector and */
/* TIArrayAsVector for examples. */
/* */
/*------------------------------------------------------------------------*/

template <class Vect, class T> class TArrayAsVectorImp
{

public:

TArrayAsVectorImp( int upper, int lower, int delta ) :
Data( upper-lower+1,delta ),
Lowerbound( lower )
{
}

int LowerBound() const
{
return Lowerbound;
}

int UpperBound() const
{
return BoundBase( Data.Limit() )-1;
}

unsigned ArraySize() const
{
return Data.Limit();
}

int IsFull() const
{
return Data.GetDelta() == 0 && Data.Count() >= Data.Limit();
}

int IsEmpty() const
{
return Data.Count() == 0;
}

unsigned GetItemsInContainer() const
{
return Data.Count();
}

#if defined( BI_OLDNAMES )
int lowerBound() const { return LowerBound(); }
int upperBound() const { return UpperBound(); }
unsigned arraySize() const { return ArraySize(); }
int isFull() const { return IsFull(); }
int isEmpty() const { return IsEmpty(); }
unsigned getItemsInContainer() const { return GetItemsInContainer(); }
#endif

void Reallocate( unsigned sz, unsigned offset = 0 )
{
Data.Resize( sz, offset );
}


void SetData( int loc, const T& t )
{
PRECONDITION( loc >= Lowerbound && loc <= UpperBound() );
Data[ ZeroBase(loc) ] = t;
}

void RemoveEntry( int loc )
{
SqueezeEntry( ZeroBase(loc) );
}

void SqueezeEntry( unsigned loc )
{
PRECONDITION( loc < Data.Count() );
Data.Detach( loc );
}

unsigned ZeroBase( int loc ) const
{
return loc - Lowerbound;
}

int BoundBase( unsigned loc ) const
{
return loc == UINT_MAX ? INT_MAX : loc + Lowerbound;
}

void Grow( int loc )
{
if( loc < LowerBound() )
Reallocate( ArraySize() + (loc - Lowerbound) );
else if( loc >= BoundBase( Data.Limit()) )
Reallocate( ZeroBase(loc) );
}

int Lowerbound;

Vect Data;

};

/*------------------------------------------------------------------------*/
/* */
/* [INTERNAL USE ONLY] */
/* */
/* template <class Vect, class T> class TDArrayAsVectorImp */
/* */
/* Implements the fundamental array operations for direct arrays, using */
/* a vector as the underlying implementation. */
/* */
/*------------------------------------------------------------------------*/

template <class Vect, class T> class TDArrayAsVectorImp :
public TArrayAsVectorImp<Vect,T>
{

public:

typedef void (*IterFunc)(T&, void *);
typedef int (*CondFunc)(const T&, void *);

TDArrayAsVectorImp( int upper, int lower, int delta ) :
TArrayAsVectorImp<Vect,T>( upper, lower, delta )
{
}

int Add( const T& t )
{
return Data.Add(t);
}

int Detach( const T& t )
{
return Data.Detach(t);
}

int Detach( int loc )
{
return Data.Detach( ZeroBase(loc) );
}

int Destroy( const T& t )
{
return Detach(t);
}

int Destroy( int loc )
{
return Detach(loc);
}

int HasMember( const T& t ) const
{
return Data.Find(t) != UINT_MAX;
}

int Find( const T& t ) const
{
return BoundBase( Data.Find( t ) );
}

T& operator []( int loc )
{
Grow( loc+1 );
return Data[ZeroBase(loc)];
}

T& operator []( int loc ) const
{
PRECONDITION( loc >= Lowerbound && ZeroBase(loc) < Data.Limit() );
return Data[ZeroBase(loc)];
}

void ForEach( IterFunc iter, void *args )
{
if( !IsEmpty() )
Data.ForEach( iter, args );
}

T *FirstThat( CondFunc cond, void *args ) const
{
if( IsEmpty() )
return 0;
return Data.FirstThat( cond, args );
}

T *LastThat( CondFunc cond, void *args ) const
{
if( IsEmpty() )
return 0;
return Data.LastThat( cond, args );
}

void Flush()
{
Data.Flush();
}

#if defined( BI_OLDNAMES )
int add( const T& t ) { return Add(t); }
int detach( const T& t,TShouldDelete::DeleteType=TShouldDelete::NoDelete)
{ return Detach(t); }
int detach( int loc,TShouldDelete::DeleteType=TShouldDelete::NoDelete)
{ return Detach(loc); }
int destroy( const T& t ) { return Destroy(t); }
int destroy( int loc,TShouldDelete::DeleteType ) { return Destroy(loc); }
int hasMember( const T& t ) const { return HasMember(t); }
void forEach( IterFunc iter, void *args )
{ ForEach( iter, args ); }
T *firstThat( CondFunc cond, void *args ) const
{ return FirstThat( cond, args ); }
T *lastThat( CondFunc cond, void *args ) const
{ return lastThat( cond, args ); }
void flush( TShouldDelete::DeleteType = TShouldDelete::DefDelete )
{ Flush(); }
#endif

protected:

const T& ItemAt( int i ) const
{
return Data[ ZeroBase(i) ];
}

};

/*------------------------------------------------------------------------*/
/* */
/* [INTERNAL USE ONLY] */
/* */
/* template <class Vect, class T> class TIArrayAsVectorImp */
/* */
/* Implements the fundamental array operations for indirect arrays, */
/* using a vector as the underlying implementation. */
/* */
/*------------------------------------------------------------------------*/

template <class Vect, class T> class TIArrayAsVectorImp :
public TArrayAsVectorImp<Vect,T *>, public TShouldDelete
{

public:

typedef void (*IterFunc)(T&, void *);
typedef int (*CondFunc)(const T&, void *);

TIArrayAsVectorImp( int upper, int lower, int delta ) :
TArrayAsVectorImp<Vect,T *>( upper, lower, delta )
{
}

~TIArrayAsVectorImp()
{
Flush();
}

int Add( T *t )
{
return Data.Add(t);
}

int Detach( T *t,
TShouldDelete::DeleteType dt = TShouldDelete::NoDelete )
{
return Data.Detach(t,DelObj(dt));
}

int Detach( int loc,
TShouldDelete::DeleteType dt = TShouldDelete::NoDelete )
{
return Data.Detach( ZeroBase(loc), DelObj(dt) );
}

int Destroy( T *t )
{
return Detach(t,TShouldDelete::Delete);
}

int Destroy( int loc )
{
return Detach(loc,TShouldDelete::Delete);
}

int HasMember( const T *t ) const
{
return Data.Find(t) != UINT_MAX;
}

int Find( const T *t ) const
{
return BoundBase( Data.Find( t ) );
}

T *& operator []( int loc )
{
Grow( loc+1 );
return Data[ZeroBase(loc)];
}

T *& o
...全文
348 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
我来看看CB 2020-07-13
  • 打赏
  • 举报
回复
不连接arrays.h不能编译吗?看看用哪个函数了。
  • 打赏
  • 举报
回复
复制OWL类库,还要设置include、lib等路径,所以你最好安装OWLNext,它的安装程序能添加路径,并且能使用你的当前编译器编译出.lib,如果你直接复制老版本BC中的classlib,它带的.lib对于新版的编译器未必能用。
这是DosBox中运行的BC++ 3.1路径设置,你参考一下:

CHNBOX 2020-06-07
  • 打赏
  • 举报
回复
引用 1 楼 ooolinux 的回复:
你怎么判断是C++ Builder 4的项目?如果是用OWL的也有可能是Borland C++ for Windows的项目。

抱歉,我没有说清楚。我们以前用C++ Builder 4 软件开发的。

引用 2 楼 Waiting4you 的回复:
看起来代码直接在头文件里,你把整个classlib文件夹复制出来给BCB6用试试能不能编译

我把classlib文件夹拷到BCB6的include文件夹里了,但是编译classlib文件夹中listimp.h时出现Member indentifier expected错误。
Waiting4you 2020-06-05
  • 打赏
  • 举报
回复
看起来代码直接在头文件里,你把整个classlib文件夹复制出来给BCB6用试试能不能编译
ooolinux 2020-06-04
  • 打赏
  • 举报
回复
你怎么判断是C++ Builder 4的项目?如果是用OWL的也有可能是Borland C++ for Windows的项目。

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧