Building and compiling Qt project on a Windows machine



  • 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

    }


  • Moderators

    @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.



  • 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)



  • 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


  • Moderators

    @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.



  • Yes !!!!!!!

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

    Thanks again


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.