Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. .pro file creates only dll - how do i build a lib too?
Forum Updated to NodeBB v4.3 + New Features

.pro file creates only dll - how do i build a lib too?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
7 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nirh
    wrote on last edited by
    #1

    Hi All,

    When building the next .pro file it produces only .dll file, How can i get a .lib file too(On windows platform) ?

    What am i missing ?

    Thanks,

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

    Project created by QtCreator 2016-10-14T03:25:26

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

    QT -= gui

    TARGET = LoggerLib
    TEMPLATE = lib
    CONFIG += debug

    HEADERS += logger.h
    win32 {
    message(Build win32 LoggerLib)

    message(pwd=$$PWD)
    contains(QMAKE_HOST.arch, X86_64) {
        QMAKE_LFLAGS += /MACHINE:X64
    } else {
        QMAKE_LFLAGS += /MACHINE:X86
        QMAKE_LFLAGS += /NOENTRY
    }
    
    release:QMAKE_CXXFLAGS += /MT
    QMAKE_CXXFLAGS += /MTd
    
    QMAKE_CXXFLAGS_DEBUG += /MTd
    QMAKE_CXXFLAGS_RELEASE += /MT
    
    CONFIG(debug, debug|release){
        DESTDIR = $$_PRO_FILE_PWD_/../Debug
        OBJECTS_DIR = $$_PRO_FILE_PWD_/../Debug
        MOC_DIR = $$_PRO_FILE_PWD_/../Debug
        RCC_DIR = $$_PRO_FILE_PWD_/../Debug
    }
    
    
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/release/ -llog4cxx
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/Debug/ -llog4cxx
    
    INCLUDEPATH += $$PWD/../../../TcpComp\3rdParty\log4cxx\log4cxx\src\main\include
    DEPENDPATH += $$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/Debug
    

    }

    raven-worxR 1 Reply Last reply
    0
    • N nirh

      Hi All,

      When building the next .pro file it produces only .dll file, How can i get a .lib file too(On windows platform) ?

      What am i missing ?

      Thanks,

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

      Project created by QtCreator 2016-10-14T03:25:26

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

      QT -= gui

      TARGET = LoggerLib
      TEMPLATE = lib
      CONFIG += debug

      HEADERS += logger.h
      win32 {
      message(Build win32 LoggerLib)

      message(pwd=$$PWD)
      contains(QMAKE_HOST.arch, X86_64) {
          QMAKE_LFLAGS += /MACHINE:X64
      } else {
          QMAKE_LFLAGS += /MACHINE:X86
          QMAKE_LFLAGS += /NOENTRY
      }
      
      release:QMAKE_CXXFLAGS += /MT
      QMAKE_CXXFLAGS += /MTd
      
      QMAKE_CXXFLAGS_DEBUG += /MTd
      QMAKE_CXXFLAGS_RELEASE += /MT
      
      CONFIG(debug, debug|release){
          DESTDIR = $$_PRO_FILE_PWD_/../Debug
          OBJECTS_DIR = $$_PRO_FILE_PWD_/../Debug
          MOC_DIR = $$_PRO_FILE_PWD_/../Debug
          RCC_DIR = $$_PRO_FILE_PWD_/../Debug
      }
      
      
      win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/release/ -llog4cxx
      else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/Debug/ -llog4cxx
      
      INCLUDEPATH += $$PWD/../../../TcpComp\3rdParty\log4cxx\log4cxx\src\main\include
      DEPENDPATH += $$PWD/../../../TcpComp/3rdParty/log4cxx/log4cxx/projects/Debug
      

      }

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @nirh
      what compiler are you using? MSVC?

      Are your lib exporting symbols? If not there is no .lib file created.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • N Offline
        N Offline
        nirh
        wrote on last edited by
        #3

        Hi @raven-worx,

        I am a Linux programer, But according to your Question, I dont think that my Lib exports any symbols,
        However the reason i thought that the .pro should produce a lib file is because i had another .pro file that is lookin to link with thge above lib.

        How can i tell the next .pro file to use a dll insted?

        Thanks

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          You are likely having a static library on one hand and a dynamic one on the other. In any case, export the symbols of your library properly and should be good to go. Here how to do it.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • N Offline
            N Offline
            nirh
            wrote on last edited by
            #5

            Hi @SGaist,

            I cannot add the Q_DECL_EXPORT or Q_DECL_IMPORT because i am linking to a third party code ( i just use a header with MACROS to that third party library),

            Maybe i need to link to the dll it creats, But the lib i linking with always conflicts eith the machine type,

            LNK1112: module machine type 'x64' conflicts with target machine type 'X86' ?

            Any idea please ?

            Thanks,

            Nirh

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nirh
              wrote on last edited by
              #6

              Hi

              Its solved by adding:
              CONFIG += staticlib

              Thanks,

              Nirh

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                You can also simply write your own macros based on Q_DECL_XXX if you don't want Qt stuff in your header.

                You were trying to link a 64bit build of your library with a 32bit target.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved