0

我正在尝试在控制台应用程序中将 abbrevia 包(https://github.com/TurboPack/Abbrevia)与 c++Builder 一起使用。首先,我尝试手动安装软件包。但后来我在 GetIt 上找到了它。无论如何设置软件包,问题仍然存在。我认为我手动进行的路径设置与软件包安装程序所做的相同。它总是导致 Abdfbase::TAbDeflateHelper:: 无法解析的外部这是原始错误消息:

[ilink32 Fehler] 错误:Nicht auflösbares externes 'Abdfbase::TAbDeflateHelper::'referenziert von c:\pathtotheobjectfile\main.obj

只需设置路径并为 c++builder 编译项目(因此获取对象)就是所有设置。有了 GetIt,我什至不必这样做。

这是我最简单的开始,我什至无法链接。

#pragma hdrstop
#pragma argsused

#ifdef _WIN32
#include <tchar.h>
#else
  typedef char _TCHAR;
  #define _tmain main
#endif

#include <stdio.h>
#include <AbDfBase.hpp>
using namespace Abdfbase;

int _tmain(int argc, _TCHAR* argv[]) 
{
    TAbDeflateHelper* helper = new TAbDeflateHelper();
    return 0;
}

这是我第一次尝试使用 c++builder。我缺少什么系统设置或特殊代码?

作为参考,导入的 .hpp 的开头显示了我尝试实例化的类。

/ CodeGear C++Builder
// Copyright (c) 1995, 2021 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'AbDfBase.pas' rev: 35.00 (Windows)

#ifndef AbdfbaseHPP
#define AbdfbaseHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <System.SysUtils.hpp>
#include <System.Classes.hpp>

//-- user supplied -----------------------------------------------------------

namespace Abdfbase
{
//-- forward type declarations -----------------------------------------------
class DELPHICLASS TAbDeflateHelper;
class DELPHICLASS TAbLogger;
class DELPHICLASS TAbNodeManager;
class DELPHICLASS EAbAbortProgress;
class DELPHICLASS EAbPartSizedInflate;
class DELPHICLASS EAbInflatePasswordError;
class DELPHICLASS EAbInternalInflateError;
class DELPHICLASS EAbInflateError;
class DELPHICLASS EAbInternalDeflateError;
class DELPHICLASS EAbDeflateError;
//-- type declarations -------------------------------------------------------
typedef System::StaticArray<int, 536870911> TAbDfIntegerList;

typedef TAbDfIntegerList *PAbDfIntegerList;

typedef void __fastcall (__closure *TAbProgressStep)(int aPercentDone);

class PASCALIMPLEMENTATION TAbDeflateHelper : public System::TObject
{
    typedef System::TObject inherited;
    
private:
    int FAmpleLength;
    int FChainLength;
    System::UnicodeString FLogFile;
    int FMaxLazy;
    TAbProgressStep FOnProgressStep;
    int FOptions;
    __int64 FPartSize;
    __int64 FSizeCompressed;
    __int64 FSizeNormal;
    __int64 FStreamSize;
    int FWindowSize;
    System::WideChar FZipOption;
    
protected:
    void __fastcall dhSetAmpleLength(int aValue);
    void __fastcall dhSetChainLength(int aValue);
    void __fastcall dhSetLogFile(const System::UnicodeString aValue);
    void __fastcall dhSetMaxLazy(int aValue);
    void __fastcall dhSetOnProgressStep(TAbProgressStep aValue);
    void __fastcall dhSetOptions(int aValue);
    void __fastcall dhSetWindowSize(int aValue);
    void __fastcall dhSetZipOption(System::WideChar aValue);
    
public:
    __fastcall TAbDeflateHelper();
    void __fastcall Assign(TAbDeflateHelper* aHelper);
    __property int AmpleLength = {read=FAmpleLength, write=dhSetAmpleLength, nodefault};
    __property int ChainLength = {read=FChainLength, write=dhSetChainLength, nodefault};
    __property System::UnicodeString LogFile = {read=FLogFile, write=dhSetLogFile};
    __property int MaxLazyLength = {read=FMaxLazy, write=dhSetMaxLazy, nodefault};
    __property int Options = {read=FOptions, write=dhSetOptions, nodefault};
    __property __int64 PartialSize = {read=FPartSize, write=FPartSize};
    __property System::WideChar PKZipOption = {read=FZipOption, write=dhSetZipOption, nodefault};
    __property __int64 StreamSize = {read=FStreamSize, write=FStreamSize};
    __property int WindowSize = {read=FWindowSize, write=dhSetWindowSize, nodefault};
    __property __int64 CompressedSize = {read=FSizeCompressed, write=FSizeCompressed};
    __property __int64 NormalSize = {read=FSizeNormal, write=FSizeNormal};
    __property TAbProgressStep OnProgressStep = {read=FOnProgressStep, write=dhSetOnProgressStep};
public:
    /* TObject.Destroy */ inline __fastcall virtual ~TAbDeflateHelper() { }
    
};
4

1 回答 1

0

设置搜索路径不会告诉编译器/链接器您实际使用的是哪些特定库。您的项目未链接到 Abbrevia 包库,因此出现错误。

如果您创建了一个 GUI 应用程序,并在设计时将 Abbrevia 组件直观地拖放到TFormTFrameTDataModule,则将为您添加必要的包库引用。

但是,在控制台应用程序中,至少没有 . TDataModule,您必须手动将 Abbrevia 的.bpi包库的引用添加到项目中。

于 2022-02-08T23:38:54.373 回答