[Qt-interest] Adding a library to my project

Martin Hofius Martin at hofius-online.com
Wed May 27 16:50:22 CEST 2009


Am Mittwoch, 27. Mai 2009 schrieb Parker:
> Well,
> for creating the library I just used the QT Creator wizard. It just created
> .a file, not .lib I don't know why. But it compiles right now with this :
>
> LIBS += d:/workspace/TestProject/libs/libsnmp_pp.a
>
> but, again, I'm not sure how to use it in my code. Maby #include
> "libs/libsnmp_pp.a" or something ? 
in Your C++ source code? Of course You have to include the header files with 
the declarations in Your code - after compilation the linker will use the lib 
file (*.a, as stated in the LIB directive in Your *.pro file) to add the real 
library content to Your program if (and only if) parts of this lib are used 
in Your program.

Martin




> ----- Original Message ----- 
>   From: Jean-Christophe Roux
>   To: Parker
>   Sent: Wednesday, May 27, 2009 3:45 PM
>   Subject: Re: [Qt-interest] Adding a library to my project
>
>   >It's created with QT Creator.
>   >workspace\MyProject\libs\myLib.a
>   >
>   >and in my .pro file I'm using
>   >LIBS += -L../libs -lmyLib.a
>   >
>   >I also tried
>   >LIBS += -L../libs -lmyLib
>
>   .a libraries are static libraries on unix and you seem to be windows. Are
> you linking to a static or shared library? Does your program execute
> properly with \MyProject\libraryFolder\debug\libtest.a?
>
>
>   From the docs:
>   Version:1.0 StartHTML:0000000105 EndHTML:0000001603
> StartFragment:0000000127 EndFragment:0000001585 For example:
>
>  unix:LIBS += -L/usr/local/lib -lmath win32:LIBS += c:/mylibs/math.lib
>
>
>   On Windows, specifying libraries with the -l option, as in the above
> example, will cause the library with the highest version number to be used;
> for example, libmath2.lib could potentially be used instead of libmathlib.
> To avoid this ambiguity, we recommend that you explicitly specify the
> library to be used by including the .lib file name suffix.
>
>
>
>
>   I would first have it work with an absolute path, then try a relative
> path.
>
>
>   You could also switch from qmake to CMake that may have bette ability to
> look for external libraries
>
>
>   JCR
>
>
>
>
>
>
>   From: Parker <userqt at gmail.com>
>   To: qt-interest at trolltech.com
>   Sent: Wednesday, May 27, 2009 8:21:06 AM
>   Subject: Re: [Qt-interest] Adding a library to my project
>
>   
>   Hm, it's not working. Here is my lib :
>   It's created with QT Creator.
>   workspace\MyProject\libs\myLib.a
>
>   and in my .pro file I'm using
>   LIBS += -L../libs -lmyLib.a
>
>   I also tried
>   LIBS += -L../libs -lmyLib
>   but no success :(
>
>
>     ----- Original Message -----
>     From: Miroslav Karpis
>     To: qt-interest at trolltech.com
>     Sent: Wednesday, May 27, 2009 2:57 PM
>     Subject: Re: [Qt-interest] Adding a library to my project
>
>
>     Hi,
>
>     I use it like following:
>
>     LIBS += -L../ext/lib \
>     -ltest
>
>     But I guess that also this should work:
>     LIBS += -L../ext/lib -ltest
>
>     Regards,
>     Miro
>
>
>     On Wed, 2009-05-27 at 14:46 +0300, Parker wrote:
>       Hello,
>       I'm using Windows XP and I'm trying to add a library to my project.
>       The library is in workspace\MyProject\libraryFolder\debug\libtest.a .
>       How do I haev to set the LIBS in my .pro file so that I don't need to
> specify the full path (o.e. D:\Documents and
> Settings\Secret\Desktop\workspace\....) Something like that maybe ?
> LIBS += -LlibraryFolder\debug -llibtest
>
>
>       __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4098 (20090522) __________
>
>       The message was checked by ESET NOD32 Antivirus.
>
>       http://www.eset.com
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>     __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4098 (20090522) __________
>
>     The message was checked by ESET NOD32 Antivirus.
>
>     http://www.eset.com
>
>
>
> ---------------------------------------------------------------------------
>-
>
>
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>     __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4098 (20090522) __________
>
>     The message was checked by ESET NOD32 Antivirus.
>
>     http://www.eset.com
>
>
>
>
>   __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4098 (20090522) __________
>
>   The message was checked by ESET NOD32 Antivirus.
>
>   http://www.eset.com
>
>
>
>
>   __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4098 (20090522) __________
>
>   The message was checked by ESET NOD32 Antivirus.
>
>   http://www.eset.com






More information about the Qt-interest-old mailing list