Results 1 to 7 of 7

Thread: Loading a TabLib .a File into project

  1. #1
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Loading a TabLib .a File into project

    Hi
    So far I've been googling for 5h and still I can't make this simple program work.
    I want to manage MP3 tags. I have chosen TagLib as my library to edit files.

    So what is what I know so far.
    I have managed to obtain .dll and .a file (so I could even choose) from here:
    http://www.joelverhagen.com/blog/201...ib-on-windows/

    and I have the include folder from TagLib homepage:
    http://developer.kde.org/~wheeler/taglib.html

    so now what I think i should do is edit my .pro file:
    INCLUDEPATH += D:\Qt\taglib\include\
    LIBS += D:\Qt\taglib

    so in include I have headers and stuff of TagLib and in taglib i got the .dll and .a file.

    Now in mainwindow.cpp I did:
    #include <tag.h> so i should be able to use the whole Library, but... i got a lot of errors and I dont understand why.

    I think that if i manage to solve first two ii will deal with the rest:

    http://s536.photobucket.com/albums/f...rent=first.png
    this one ilustrates that i think i should define how i am going to include (dynamic or static) library. But i dont understand why the include has an unbuild cmake file and simply changing extension is not working properly.

    http://s536.photobucket.com/albums/f...ent=second.png
    and this one shows that taglib is using fstring but according to compiler my computer is not... and I really dont know how to solve this one cos I simply miss another library.


    Would id3lib be easier to use?
    I just need to read and write tags, dont care about speed and stuff.
    But still i cant find any examples of using this libs or even how to properly load them into project ; (

    Thanks in advance.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Loading a TabLib .a File into project

    Please do not link to external resources in your posts; upload the images here so that they do not disappear leaving a useless post here. Feel free to edit your post to fix it.

    Your problem is not taglib, so switching libraries will not help you. Your images show that include files are not being found. That is, your INCLUDEPATH is wrong. Your LIBS variable is not in play with the errors you show but it is also incorrect.

    The necessary qmake variables would be something like:
    Qt Code:
    1. TAGLIBDIR = D:/taglib-1.6.3
    2. INCLUDEPATH += $$(TAGLIBDIR)/include
    3. LIBS += -L$$(TAGLIBDIR)/lib -ltag
    To copy to clipboard, switch view to plain text mode 
    where d:/taglib-1.6.3 is where you installed taglib (adjust as required). Have a look in that directory to see that the header and library files are there.
    Last edited by ChrisW67; 8th February 2011 at 22:35. Reason: updated contents

  3. #3
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Loading a TabLib .a File into project

    Yes u were a bit right.

    So i solved one problem to encounter another/
    Well unfortunately I moved to Ubuntu because i found it a bit easier to install the libs etc.

    What I did so far:


    Download TagLib.
    cd /taglib
    ./configure
    make
    sudo make install


    Open new project in QT.
    TAGLIBDIR = /home/atais/Desktop/taglib-1.6.3
    INCLUDEPATH += $$(TAGLIBDIR)/taglib

    no need for library??
    Because I didnt build any??

    But now when I added this to project I can use:
    #include <taglib/tag.h> etc.
    QT is even telling me the ending, so it finds it somehow correct, but still...

    as u can see on prtscn.. the classes are not working correctly... and i dont undestand why now


    Its the same when I am using their examples so... i think there must still be some declaration problems :/
    Attached Images Attached Images
    Last edited by Atais; 8th February 2011 at 23:59.

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

    Default Re: Loading a TabLib .a File into project

    Quote Originally Posted by Atais View Post
    What I did so far:
    Download TagLib.
    cd /taglib
    ./configure
    make
    sudo make install
    Ok. A default build and install. So, the configure prefix was /usr/local.

    Open new project in QT.
    TAGLIBDIR = /home/atais/Desktop/taglib-1.6.3
    INCLUDEPATH += $$(TAGLIBDIR)/taglib
    Taglib has been installed into /usr/local not /home/atais/Desktop/taglib-1.6.3. My original response is still correct with:
    Qt Code:
    1. TAGLIBDIR = /usr/local
    To copy to clipboard, switch view to plain text mode 

    no need for library??
    Because I didnt build any??
    Why do you say that? You clearly built and installed the library.

  5. #5
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Loading a TabLib .a File into project

    omfg I got confused in all of this :P
    but now I understand.

    TAGLIBDIR = /usr/local
    INCLUDEPATH += $$(TAGLIBDIR)/include
    LIBS += -L$$(TAGLIBDIR)/lib -ltag

    and it now works... perfectly.

    Could u just tell me, now if I want to move this app to Windows, specially without installed taglib and QT Creator, I know I should look for some .dll files from QT like QTGui etc...

    what about taglib?
    in /usr/local/lib there are some files:

    libtag_c.la
    libtag_c.so
    libtag_c.so.0
    libtag_c.so.0.0.0
    libtag.la
    libtag.so
    libtag.so.1
    libtag.so.1.9.0

    but i am quite sure they wont work, i need dll or sth like that. So what should i do ?
    and how could I build the app so I would work on Windows?

    ok I understand it all by now.
    I clearly need to build taglib under windows so I would have header files as on linux in /include
    and I would obtain a proper DLL/a file as well. (am I wrong?)
    If not the only problem I have is with building this app since I see I've done it all wrong :P.
    Last edited by Atais; 9th February 2011 at 10:45.

  6. #6
    Join Date
    Feb 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Loading a TabLib .a File into project

    Ok i think I got it... the other way actually.
    I know what I've done wrong but still I can't compile taglib on windows. Just impossible for me.

    I am giving a try to id3lib but to do so I need to download Visual Studio and msdnaa is very slow this days.
    Hopefully i have understood how it works... and it took me 2 days
    I think I start a blog or sth, so I could post positive effects somewhere and others could use it as help.
    Thanks!

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

    Default Re: Loading a TabLib .a File into project

    On Windows you use CMake rather than configure to produce the Makefile. The install location is the CMAKE_INSTALL_PREFIX variable you can set in CMake (Install CMake Item 6 in the instruction you linked). The build and install are the same after that (i.e. make && make install ).

    You then set TAGLIBDIR in your PRO file to the same value as the CMAKE_INSTALL_PREFIX and you should be good to go. You may need to wrap the path in quotes if it contains spaces as the example does:
    Qt Code:
    1. TAGLIBDIR = $$quote(C:/Program Files/taglib)
    2. INCLUDEPATH += $$quote( $${TAGLIBDIR}/include )
    3. LIBS += -L$$quote($${TAGLIBDIR}/lib) -ltag
    To copy to clipboard, switch view to plain text mode 
    Please note that I have changed some of the parentheses () to braces {}... I had the wrong ones in my earlier post.

    You may find you need:
    Qt Code:
    1. INCLUDEPATH += $$quote( $${TAGLIBDIR}/include/taglib )
    To copy to clipboard, switch view to plain text mode 
    if your source goes:
    Qt Code:
    1. #include <tag.h>
    2. // as some of the examples do, rather than
    3. #include <taglib/tag.h>
    To copy to clipboard, switch view to plain text mode 
    Last edited by ChrisW67; 9th February 2011 at 22:26. Reason: reformatted to look better

Similar Threads

  1. Replies: 3
    Last Post: 3rd August 2010, 13:12
  2. QML file not loading external JS file?
    By anothertest in forum Qt Programming
    Replies: 2
    Last Post: 14th April 2010, 09:11
  3. Qt Creator - problem loading project
    By Ferric in forum Newbie
    Replies: 1
    Last Post: 7th January 2010, 22:25
  4. Replies: 1
    Last Post: 3rd December 2009, 23:34
  5. OpenGL file loading formats
    By TheKedge in forum Qt Programming
    Replies: 0
    Last Post: 6th August 2008, 15:44

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.