Results 1 to 7 of 7

Thread: create .lib using Visual Studio

  1. #1
    Join Date
    Feb 2008
    Posts
    157
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default create .lib using Visual Studio

    I want to use qextserialport with Visual Studio 2005. I compiled the libary but get only a .dll and .a file.

    How do I have to modify the .pro file to get a .lib file?

    Matthias

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: create .lib using Visual Studio

    MSVC doesn't produce .a files, MinGW does. Could you show us the compiler output?
    J-P Nurmi

  3. #3
    Join Date
    Feb 2008
    Posts
    157
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create .lib using Visual Studio

    Quote Originally Posted by jpn View Post
    MSVC doesn't produce .a files, MinGW does. Could you show us the compiler output?
    No. MSVC does produce .a files, but how are these related to .lib files? mingw produces .lib
    files directly.

    I have no idea what the compiler output should contain but here it is:
    E:\Daten\Dev\Qt\Bibliotheken\qextserialport-1.1\qextserialport>qmake

    E:\Daten\Dev\Qt\Bibliotheken\qextserialport-1.1\qextserialport>nmake

    Microsoft (R) Program Maintenance Utility, Version 8.00.50727.762
    Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

    cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -W3 -w34100 -w34189 -GR -EHsc
    -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -D_TTY_WIN_ -DQT_THREAD_SUPPORT -DQT_DL
    L -DQT_NO_DEBUG -DQT_CORE_LIB -I"c:\Programme\Qt4\include\QtCore" -I"c:\Programm
    e\Qt4\include\QtCore" -I"c:\Programme\Qt4\include" -I"c:\Programme\Qt4\include\A
    ctiveQt" -I"build\moc" -I"." -I"c:\Programme\Qt4\mkspecs\default" -Fobuild\obj\
    @C:\DOKUME~1\Matthias\LOKALE~1\Temp\nm293.tmp
    qextserialbase.cpp
    qextserialport.cpp
    win_qextserialport.cpp
    .\win_qextserialport.cpp(343) : warning C4100: 'c': Unreferenzierter formaler Pa
    rameter
    Code wird generiert...
    link /LIBPATH:"c:\Programme\Qt4\lib" /NOLOGO /INCREMENTAL:NO /DLL /MANIF
    ESTFILE:"build/obj\qextserialport.intermediate.manifest" /OUT:build\qextserialpo
    rt.dll @C:\DOKUME~1\Matthias\LOKALE~1\Temp\nm294.tmp
    mt.exe -nologo -manifest "build\obj\qextserialport.intermediate.manifes t
    " -outputresource:build\qextserialport.dll;2
    Matthias

  4. #4
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create .lib using Visual Studio

    .lib -> static lib msvc
    .d -> static lib mingw

    .a or .lib -> static import lib (mingw/msvc)
    .dll -> shared lib

    so you either have to create your lib as static lib or make sure to export (search forum for Q_DECL_EXPORT / Q_DECL_IMPORT) to functions/classes you want to access from outside the lib.

  5. #5
    Join Date
    Feb 2008
    Posts
    157
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create .lib using Visual Studio

    Quote Originally Posted by ChristianEhrlicher View Post
    .lib -> static lib msvc
    .d -> static lib mingw

    .a or .lib -> static import lib (mingw/msvc)
    .dll -> shared lib
    what is the difference between "static import" and "static lib" ?

    I have the .a lib. But the code request the .lib file. Can I simply rename it?

    Quote Originally Posted by ChristianEhrlicher View Post
    so you either have to create your lib as static lib
    The main question of this thread was the "how do I do this".

    Quote Originally Posted by ChristianEhrlicher View Post
    or make sure to export (search forum for Q_DECL_EXPORT / Q_DECL_IMPORT) to functions/classes you want to access from outside the lib.
    This implies to change the whole code if the lib, doesn't it?
    This is beyond the work I want to spent on the code of an 3dparty libary.

    Matthias

  6. #6
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create .lib using Visual Studio

    When you compile a library with msvc you will never ever get a .a lib
    A static import lib contains only stubs to the functions in the shared lib. It's needed by the linker to resolve them.

    When you use qmake -> RTM or just compile the code into your app instead creating an own lib.

  7. #7
    Join Date
    Feb 2008
    Posts
    157
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create .lib using Visual Studio

    Quote Originally Posted by ChristianEhrlicher View Post
    When you compile a library with msvc you will never ever get a .a lib
    You are correct. I had an old .a file from a mingw compilation

    I now added 'staticlib' to CONFIG and recieve a .lib file now.
    Thanks,

    Matthias

Similar Threads

  1. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  2. Replies: 2
    Last Post: 23rd November 2007, 17:44
  3. Qt configure with msvc.net
    By jivanr in forum Installation and Deployment
    Replies: 1
    Last Post: 11th June 2007, 08:17
  4. Visual Studio App Wizard for Qt
    By joshlareau in forum Qt-based Software
    Replies: 4
    Last Post: 9th February 2007, 20:36
  5. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15

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.