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

Patric userqt at gmail.com
Sun Aug 2 13:16:16 CEST 2009


Well, the name of my lib is TestLib and is compiled with Microsoft Visual 
C++.
In my project folder I have a folder "libs", and in that folder my TestLib 
is placed.

And here is my .pro file :

#-------------------------------------------------
#

# Project created by QtCreator 2009-08-01T16:55:20

#

#-------------------------------------------------


QT -= gui


TARGET = LibTestProgram

CONFIG += console

CONFIG -= app_bundle

LIBS += -L../libs -lTestLib


TEMPLATE = app



SOURCES += main.cpp


Result :
C:\Qt\2009.03\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: 
cannot find -lTestLib
collect2: ld returned 1 exit status


What am I missing ?

----- Original Message ----- 
From: "John McClurkin" <jwm at nei.nih.gov>
To: <qt-interest at trolltech.com>
Sent: Saturday, August 01, 2009 6:25 PM
Subject: Re: [Qt-interest] Adding a library created with QT Creator


> Patric wrote:
>> I see...
>> and how can I refer to the relative path of my workspace ?
> LIBS += -L../../pathtolib -lfoo
>
>>
>> ----- Original Message ----- From: "John McClurkin" <jwm at nei.nih.gov>
>> To: <qt-interest at trolltech.com>
>> Sent: Saturday, August 01, 2009 5:49 PM
>> Subject: Re: [Qt-interest] Adding a library created with QT Creator
>>
>>
>>> 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
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 




More information about the Qt-interest-old mailing list