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. Building and compiling Qt project on a Windows machine

Building and compiling Qt project on a Windows machine

Scheduled Pinned Locked Moved Solved Installation and Deployment
6 Posts 2 Posters 2.6k Views
  • 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 A Former User
    #1

    Hi ,

    I am trying to compile and build ( a Qt .pro file ) ,
    I am trying t link a lib (lib4cxx.lib) to my QTlib (LoggerLib)

    Help will be appriciated

    I am facing the next linkage error: (What am i missing?)

    LINK : warning LNK4001: no object files specified; libraries used
    LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
    debug\LoggerLib.dll : fatal error LNK1120: 1 unresolved externals

    This is my .pro file:

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

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

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

    QT -= gui

    TARGET = LoggerLib
    TEMPLATE = lib
    CONFIG += debug

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

    contains(QMAKE_HOST.arch, X86_64) {
    QMAKE_LFLAGS += /MACHINE:X64
    } else {
    QMAKE_LFLAGS += /MACHINE:X86
    }

    QMAKE_CXXFLAGS_DEBUG += /MTd
    QMAKE_CXXFLAGS_RELEASE += /MT

    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

    }

    K 1 Reply Last reply
    0
    • N nirh

      I just googled and i think i need to add /NOENTRY flag to my .pro file file.
      How can i do that and where?

      Thanks

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #5

      @nirh

      You could use QMAKE_LFLAGS += entry in .pro file.

      I am not sure if that is really for your case. The header include file with macros may be consider already as a library similar to template file are also referred as a library (e.g. stl) which is basically a bunch of include files. However, what would be the purpose of packing it to a binary library?
      IMHO you should simply use your include file with the macros and link the external lib to your application whenever the macros are used.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      3
      • N nirh

        Hi ,

        I am trying to compile and build ( a Qt .pro file ) ,
        I am trying t link a lib (lib4cxx.lib) to my QTlib (LoggerLib)

        Help will be appriciated

        I am facing the next linkage error: (What am i missing?)

        LINK : warning LNK4001: no object files specified; libraries used
        LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
        debug\LoggerLib.dll : fatal error LNK1120: 1 unresolved externals

        This is my .pro file:

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

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

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

        QT -= gui

        TARGET = LoggerLib
        TEMPLATE = lib
        CONFIG += debug

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

        contains(QMAKE_HOST.arch, X86_64) {
        QMAKE_LFLAGS += /MACHINE:X64
        } else {
        QMAKE_LFLAGS += /MACHINE:X86
        }

        QMAKE_CXXFLAGS_DEBUG += /MTd
        QMAKE_CXXFLAGS_RELEASE += /MT

        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

        }

        K Offline
        K Offline
        koahnig
        wrote on last edited by
        #2

        @nirh

        But where is the source of your logger lib?

        You specify HEADERS, where you add one include header, but you have no SOURCES statement in your pro-file. Therefore, you have no source to be compiled and put into your library. So far the external lib is irrelevant.

        Vote the answer(s) that helped you to solve your issue(s)

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

          Hi koahnig,

          No Sorces dir is necessary, i am using a header file with MACROs. (Thaere for i had to link to lib)

          This is appx my header ( Header include the source file as MACRO)

          #define SIV_LOG_TRACE FunctionTrace functionTrace(logger, PRETTY_FUNCTION)
          #define SIV_LOG_DEBUG(m) LOG4CXX_DEBUG(logger, m)
          #define SIV_LOG_INFO(m) LOG4CXX_INFO(logger, m)
          #define SIV_LOG_WARN(m) LOG4CXX_WARN(logger, m)
          #define SIV_LOG_WARN2(e, m) LOG4CXX_WARN(logger, #e << " - " << e << " " << m)
          #define SIV_LOG_ERROR(m) LOG4CXX_ERROR(logger, m)
          #define SIV_LOG_ERROR2(e, m) LOG4CXX_ERROR(logger, #e << " - " << e << " " << m)
          #define SIV_LOG_FATAL(m) LOG4CXX_FATAL(logger, m)

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

            I just googled and i think i need to add /NOENTRY flag to my .pro file file.
            How can i do that and where?

            Thanks

            K 1 Reply Last reply
            0
            • N nirh

              I just googled and i think i need to add /NOENTRY flag to my .pro file file.
              How can i do that and where?

              Thanks

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #5

              @nirh

              You could use QMAKE_LFLAGS += entry in .pro file.

              I am not sure if that is really for your case. The header include file with macros may be consider already as a library similar to template file are also referred as a library (e.g. stl) which is basically a bunch of include files. However, what would be the purpose of packing it to a binary library?
              IMHO you should simply use your include file with the macros and link the external lib to your application whenever the macros are used.

              Vote the answer(s) that helped you to solve your issue(s)

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

                Yes !!!!!!!

                Thanks --- It solved the issue
                @koahnig -- You are the man!!!!

                Thanks again

                1 Reply Last reply
                1

                • Login

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