Creating a static library under windows 7-64 with QT

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating a static library under windows 7-64 with QT

Chaos Total

Hello,


I am new to Tagscan. I dowloaded the library files (version 1.11.1) and, not being a user of CMake, I tried to compile them directly by adding to a Qt console project, whose "main" function just called a simple test function like


void test()

{

    TagLib::FileRef f("../test/Albeniz.mp3");
    TagLib::String title = f.tag()->title();
    wstring tit=title.toWString();
  wcout<<tit;
}

and it worked!! (with a '#define TAGLIB_STATIC').


   Than, I tried to create a static Taglib library: I created a new Qt "static library" project, added the .cpp and .h files to it as above, and built the library, generating a 'taglib.a' file. In another Qt console project I just call the same test() function and tried to link it to my static library using a statement 'LIBS += taglib.a' in the .pro file. It finds the library file, but does not link to any function, I get a long list of errors of the form


-1: error: undefined reference to `_imp___ZN6TagLib8FileNameC1EPKc'


etc. For some reason, the functions seem not available on the library. I suspect my library exports not to be correctly configured, but don't know what to do.


     Suggestions are welcome.


     Best,


              chaos = jc


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating a static library under windows 7-64 with QT

Anton Sergunov

It should be something like
LIBS += -L<path to taglib.a> -ltaglib.a


вт, 25 июл. 2017 г., 23:06 Chaos Total <[hidden email]>:

Hello,


I am new to Tagscan. I dowloaded the library files (version 1.11.1) and, not being a user of CMake, I tried to compile them directly by adding to a Qt console project, whose "main" function just called a simple test function like


void test()

{

    TagLib::FileRef f("../test/Albeniz.mp3");
    TagLib::String title = f.tag()->title();
    wstring tit=title.toWString();
  wcout<<tit;
}

and it worked!! (with a '#define TAGLIB_STATIC').


   Than, I tried to create a static Taglib library: I created a new Qt "static library" project, added the .cpp and .h files to it as above, and built the library, generating a 'taglib.a' file. In another Qt console project I just call the same test() function and tried to link it to my static library using a statement 'LIBS += taglib.a' in the .pro file. It finds the library file, but does not link to any function, I get a long list of errors of the form


-1: error: undefined reference to `_imp___ZN6TagLib8FileNameC1EPKc'


etc. For some reason, the functions seem not available on the library. I suspect my library exports not to be correctly configured, but don't know what to do.


     Suggestions are welcome.


     Best,


              chaos = jc


Loading...