[Qt-interest] Adding a library created with QT Creator

John McClurkin jwm at nei.nih.gov
Sat Aug 1 16:49:51 CEST 2009


Patric wrote:
> Hi guys,
> I have created a static library project using QT Creator 1.2 and QT 4.5 
> on Windows XP.
> And it's compiling, but it creates *.a file, not *.lib. I thought on 
> Windows static libraries are ending with *.lib .
>  
> Anyway, I'm trying to use this library in another project, also created 
> with QT Creator. I have read the documentation here 
> http://doc..trolltech.com/4.5/qmake-project-files.html 
> <http://doc.trolltech.com/4.5/qmake-project-files.html>
> regarding Declaring Other libraries, but I actually want to place my *.a 
> in my workspace under a folder "libs". I think it's pretty 
> straightforward to do that only by including the LIBS with the 
> additional parameters. And after compilation just include the headers...
> Can someone tell me what parameters should that LIBS have in my case ?
>  
> Thank you in advance

If you are using QT Creator on Windows, you are also compiling with the 
MinGW gcc compiler. This compiler produces static libraries with a .a 
extension, as in 'nix operating systems. There are no settings that 
cause MinGW gcc to create a static library with the .lib extension. It 
is the Microsoft compilers that produce static libs with a .lib extension.
Gcc libraries traditionally have names like libfoo.a. To include 
libfoo.a in your project just add a line
LIBS += -Lpathtolib -lfoo



More information about the Qt-interest-old mailing list