Results 1 to 7 of 7

Thread: How to include id3lib library in Qt (Windows)

  1. #1
    Join Date
    Jan 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Unhappy How to include id3lib library in Qt (Windows)

    Hello,

    I want to use id3libs library, but I can't include it. How come ?

    - I have downloaded libraries here (.h, .dll, .lib, .exp and .a).

    - I put all these files in one folder, so I've got this :
    -> audioProject/
    - a.mp3
    - audioProject.pro
    - audioProject.pro.user
    - audioProject.cpp
    - audioProject.h
    - id3.h
    - main.cpp
    -> id3/
    - field.h
    - globals.h
    - id3lib.dll
    - id3lib.lib
    - ...


    - I have added bellow lines in my .pro file :
    Qt Code:
    1. INCLUDEPATH += $$PWD/id3/
    2. LIBS += -L$$PWD/id3/ -lid3lib
    3. HEADERS += audioProject.h # I did not included id3lib headers
    To copy to clipboard, switch view to plain text mode 

    - I wrote these lines in my audioProject.cpp file :
    Qt Code:
    1. #include <id3/tag.h>
    To copy to clipboard, switch view to plain text mode 

    - But when I try an example, I've got errors :
    Qt Code:
    1. ID3_Tag tag("a.mp3");
    To copy to clipboard, switch view to plain text mode 

    Here are compilation errors :

    Qt Code:
    1. undefined reference to ID3_Tag::ID3_Tag(char const*)
    2. undefined reference to ID3_Tag::~ID3_Tag()
    To copy to clipboard, switch view to plain text mode 


    "undefined reference" is because of bad libraries inclusion. But in my case, I am confused.
    How can I fix it ? (I am using Qt 5.1.1, Qt Creator 4.8.2 on Windows 7 64 bits).

    Thank you

  2. #2
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to include id3lib library in Qt (Windows)

    Which compiler do you use? You can't use a library built with msvc when compiling your own application with MinGW for example.

  3. #3
    Join Date
    Jan 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to include id3lib library in Qt (Windows)

    Yes, I am using MinGW.
    I see g++ -c -pipe XXX in my compiler log.

    So what should I change ?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,590
    Thanks
    13
    Thanked 1,586 Times in 1,515 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to include id3lib library in Qt (Windows)

    You could start by posting the entire linker command that lead to the error.

    Edit:
    Actually, you need to build the C++ id3 library with MingW if your project is compiled with MingW. The id3lib.lib file indicates you have an MSVC built C++ library.

  5. #5
    Join Date
    Jan 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to include id3lib library in Qt (Windows)

    This is my compiler log :


    Qt Code:
    1. C:/Qt/Qt5.1.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
    2. mingw32-make[1]:
    3.  
    4. Entering directory 'C:/Users/David/Documents/Qt Project/build-audioProject-Desktop_Qt_5_1_1_MinGW_32bit-Debug'
    5.  
    6. g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG
    7. -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\audioProject -I"..\audioProject\id3"
    8. -I"..\..\..\..\..\Qt\Qt5.1.1\5.1.1\mingw48_32\include" -I"..\..\..\..\..\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtWidgets"
    9. -I"..\..\..\..\..\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtGui" -I"..\..\..\..\..\Qt\Qt5.1.1\5.1.1\mingw48_32\include\QtCore"
    10. -I"debug" -I"." -I"." -I"..\..\..\..\..\Qt\Qt5.1.1\5.1.1\mingw48_32\mkspecs\win32-g++" -o debug\audioProject.o ..\audioProject\audioProject.cpp
    11.  
    12. In file included from ..\audioProject/id3/utils.h:37:0,
    13. from ..\audioProject/id3/tag.h:34,
    14. from ..\audioProject\audioProject.cpp:14:
    15. ..\audioProject/id3/id3lib_strings.h:102:7: warning: unused parameter '__c' [-Wunused-parameter]
    16. to_char_type(const int_type& __c)
    17. ^
    18. ..\audioProject/id3/id3lib_strings.h:106:7: warning: unused parameter '__c' [-Wunused-parameter]
    19. to_int_type(const char_type& __c) { return int_type(); }
    20. ^
    21. In file included from ..\audioProject/id3/id3lib_frame.h:31:0,
    22. from ..\audioProject/id3/tag.h:32,
    23. from ..\audioProject\audioProject.cpp:14:
    24. ..\audioProject/id3/globals.h:542:20: warning: 'ID3_v1_genre_description' defined but not used [-Wunused-variable]
    25. static const char *ID3_v1_genre_description[ID3_NR_OF_V1_GENRES] =
    26. ^
    27.  
    28. g++ -Wl,-subsystem,windows -mthreads -o debug\audioProject.exe debug/main.o debug/audioProject.o debug/about.o debug/qrc_images.o
    29. debug/moc_audioProject.o debug/moc_about.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind
    30. "-LC:/Users/David/Documents/Qt Project/audioProject/id3/" -lid3lib -LC:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib -lQt5Widgetsd -lQt5Guid -lQt5Cored
    31.  
    32. debug/audioProject.o: In function `ZN3audioProject22on_folder_view_clickedERK11QModelIndex':
    33. C:\Users\David\Documents\Qt Project\build-audioProject-Desktop_Qt_5_1_1_MinGW_32bit-Debug/../audioProject/audioProject.cpp:96: undefined reference to `ID3_Tag::ID3_Tag(char const*)'
    34. C:\Users\David\Documents\Qt Project\build-audioProject-Desktop_Qt_5_1_1_MinGW_32bit-Debug/../audioProject/audioProject.cpp:96: undefined reference to `ID3_Tag::~ID3_Tag()'
    35. collect2.exe: error: ld returned 1 exit status
    36.  
    37. Makefile.Debug:86: recipe for target 'debug\audioProject.exe' failed
    38. mingw32-make[1]: Leaving directory 'C:/Users/David/Documents/Qt Project/build-audioProject-Desktop_Qt_5_1_1_MinGW_32bit-Debug'
    39. makefile:34: recipe for target 'debug' failed
    40. mingw32-make[1]: *** [debug\audioProject.exe] Error 1
    41. mingw32-make: *** [debug] Error 2
    To copy to clipboard, switch view to plain text mode 


    As you can see, libraries path are right, but they are not accepted.
    I think it is really because I use MinGW.

    How can I rebuild it to work with MinGW ?

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,590
    Thanks
    13
    Thanked 1,586 Times in 1,515 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to include id3lib library in Qt (Windows)

    Download id3lib source
    Read instructions
    Build

    Edit: You may need a full MingW/MSys environment and it may not compile unmodified.
    Last edited by ChrisW67; 12th January 2014 at 06:49.

  7. #7
    Join Date
    Jan 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to include id3lib library in Qt (Windows)

    The solution was to update my gcc version.

Similar Threads

  1. Replies: 1
    Last Post: 19th September 2013, 18:32
  2. Replies: 1
    Last Post: 7th February 2013, 09:51
  3. How to include library using config+=mylibrary
    By marcvanriet in forum Qt Programming
    Replies: 8
    Last Post: 11th September 2011, 21:17
  4. compiling id3lib on windows Qt
    By harkon in forum Qt Programming
    Replies: 7
    Last Post: 26th April 2010, 22:15
  5. id3lib library problem
    By acix in forum General Programming
    Replies: 2
    Last Post: 11th April 2006, 13:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.