简体   繁体   English

如何使id3lib在C ++ Builder 10.2中工作?

[英]How to make id3lib works in C++ Builder 10.2?

How to install this library in C++ Builder 10.2 on Windows 7? 如何在Windows 7的C ++ Builder 10.2中安装此库? I copied id3lib.dll from "id3lib-3.8.3 win binaries/debug" and put in folder with my project .exe file, than I created id3lib.lib by ImpLib (with using -a option) and added to my project. 我从“ id3lib-3.8.3 win binaries / debug”复制了id3lib.dll,并将其与我的项目.exe文件放到文件夹中,然后我通过ImpLib创建了id3lib.lib(使用-a选项)并添加到了我的项目中。 After that I linked header folder (id3) to my project and wrote #include "id3/tag.h" . 之后,我将头文件夹(id3)链接到我的项目,并编写了#include "id3/tag.h" When I'm trying to compile, I get: 当我尝试编译时,我得到:

[bcc32 Fatal Error] globals.h(56): F1003 Error directive: read message above or win32.readme.first.txt [bcc32致命错误] globals.h(56):F1003错误指令:读取上述消息或win32.readme.first.txt

What am I doing wrong to install this library? 安装此库我在做什么错?

There is an #error directive on line 56 of globals.h : globals.h第56行有一个#error指令:

#ifdef WIN32
#  define LINKOPTION_STATIC         1 //both for use and creation of static lib
#  define LINKOPTION_CREATE_DYNAMIC 2 //should only be used by prj/id3lib.dsp
#  define LINKOPTION_USE_DYNAMIC    3 //if your project links id3lib dynamic
#  ifndef ID3LIB_LINKOPTION
#    pragma message("*** NOTICE *** (not a real error)")
#    pragma message("* You should include a define in your project which reflect how you link the library")
#    pragma message("* If you use id3lib.lib or libprj/id3lib.dsp (you link static) you should add")
#    pragma message("* ID3LIB_LINKOPTION=1 to your preprocessor definitions of your project.")
#    pragma message("* If you use id3lib.dll (you link dynamic) you should add ID3LIB_LINKOPTION=3")
#    pragma message("* to your preprocessor definitions of your project.")
#    pragma message("***")
#    error read message above or win32.readme.first.txt // <-- HERE

The compiler reaches the #error if WIN32 is defined but ID3LIB_LINKOPTION is NOT defined. 如果定义了WIN32 ,但ID3LIB_LINKOPTION则编译器将ID3LIB_LINKOPTION #error

As you can see in the "message above", you need to manually define ID3LIB_LINKOPTION in your project according to how you are linking to the ID3 library. 如您在“上面的消息”中所看到的,您需要根据链接到ID3库的方式在项目中手动定义ID3LIB_LINKOPTION You have not done that yet, which is why you are getting the error. 您还没有这样做,这就是为什么您得到此错误。

Go into your Project Options and add an entry for ID3LIB_LINKOPTION=3 (since you are using the DLL version of the ID3 library) in the Conditionals section. 进入“项目选项”,并在“条件”部分添加ID3LIB_LINKOPTION=3的条目(因为您使用的是ID3库的DLL版本)。 Or, put a #define ID3LIB_LINKOPTION 3 statement in your C++ code above any #include statements for ID3 header files. 或者,在C ++代码#define ID3LIB_LINKOPTION 3语句放在ID3头文件的任何#include语句上方。

Also, make sure you add your generated id3lib.lib file to your project using the Project Manager, or put a #pragma comment(lib, "id3lib.lib") directive somewhere in your C++ code. 另外,请确保使用项目管理器将生成的id3lib.lib文件添加到项目中,或将#pragma comment(lib, "id3lib.lib")指令放在C ++代码中的某个位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM