0

How to install this library in C++ Builder 10.2 on Windows 7? 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. After that I linked header folder (id3) to my project and wrote #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

What am I doing wrong to install this library?

Avtem
  • 55
  • 1
  • 10
  • Did you do what the error message says? Read `win32.readme.first.txt` for instructions. You probably missed a step in the installation, such as configuring one of the library's header files for your compiler environment. – Remy Lebeau May 24 '18 at 19:24
  • I did not follow those instructions, I used .dll from "id3lib 3.8.3 windows binaries" folder. `win32.readme.first.txt` says, that I should create .dll, .lib by myself using `id3lib/prj` and `id3lib/libprj`. – Avtem May 25 '18 at 06:32
  • What is the actual condition in `tag.h` that triggers the error message? – Remy Lebeau May 25 '18 at 14:23
  • > 56 #error read message above or win32.readme.first.txt – Avtem May 25 '18 at 15:52
  • That is not what I meant. Clearly there is an `#error` directive in the code to make the compiler display the error message, but what *condition* causes the compiler to reach that directive in the first place? Is there an `#if/#endif` surrounding the `#error`? And what does the "message above" say? You shouldn't make people have to hunt for this kind of information. – Remy Lebeau May 25 '18 at 16:18
  • Nevermind, I just downloaded the source code for myself, and will post an answer. – Remy Lebeau May 25 '18 at 16:23
  • Well, it seems like IMPLIB unable to convert id3lib.dll to proper .lib file. At least with C++ Builder 10.2 Tokyo – Avtem Feb 15 '19 at 18:42

1 Answers1

0

There is an #error directive on line 56 of globals.h:

#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.

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. 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. Or, put a #define ID3LIB_LINKOPTION 3 statement in your C++ code above any #include statements for ID3 header files.

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.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • So, it compiles successfully, but when I add an object: `ID3_Tag myTag("song.mp3");` I get the error: ** [ilink32 Error] Error: Unresolved external 'ID3_Tag::~ID3_Tag()' referenced from T:\0101 PROG\PLAYER\WIN32\DEBUG\UNIT1.OBJ.** – Avtem May 26 '18 at 07:28
  • Any suggestions? – Avtem Jun 04 '18 at 14:40