Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Linking static library for BugSplat fails



  • Hy folks,

    I am trying to include BugSplat into my project. I use Qt Creator for development and followed the instructions from the link.

    When I want to build the project, I get the following error:

    main.cpp:27: Fehler: undefined reference to `_imp___ZN13MiniDmpSenderC1EPKwS1_S1_S1_m'
    

    Here is the project file:

    QT       += core gui sql network
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = Mars
    TEMPLATE = app
    CONFIG += c++11
    
    SOURCES +=\
        main.cpp \
        ...
    
    HEADERS  += \
        ...
        ../BugSplat/inc/BugSplat.h
    
    win32 {
        RC_FILE = Mars.rc
        QMAKE_CXXFLAGS *= -fstack-protector-all --param ssp-buffer-size=1
        QMAKE_LFLAGS *= -fstack-protector-all --param ssp-buffer-size=1
    }
    
    DEFINES += QT_NO_DEBUG_OUTPUT \
               QT_NO_WARNING_OUTPUT
    
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../BugSplat/lib/ -lBugSplat
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../BugSplat/lib/ -lBugSplat
    
    INCLUDEPATH += $$PWD/../BugSplat
    DEPENDPATH += $$PWD/../BugSplat
    
    win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../BugSplat/lib/BugSplat.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../BugSplat/lib/BugSplat.lib
    

    And here is the main.cpp:

    #include "../BugSplat/inc/BugSplat.h"
    
    int main(int argc, char *argv[])
    {
        // BugSplat initialization
        QString sApp = "TestName";
        wchar_t *app = new wchar_t[sApp.size() + 1];
        sApp.toWCharArray(app);
    
        QString sDataBase = "TestDataBase";
        wchar_t *dataBase = new wchar_t[sDataBase.size() + 1];
        sDataBase.toWCharArray(dataBase);
    
        QString sVersion = QString(GLOBAL_MARS_VERSION);
        wchar_t *version = new wchar_t[sVersion.size() + 1];
        sVersion.toWCharArray(version);
    
        MiniDmpSender *mpSender = new MiniDmpSender(app, dataBase, version, NULL);
        ...
    }
    
    

    I really got stucked there. I am using MinGW 4.9.2 as compiler.

    Please give some ideas to solve this issue!


  • Lifetime Qt Champion

    @SebastianS Which compiler was used to build that static library?
    I'm asking because you cannot mix different compiler in same project (even not different versions of Visual C++ compiler).



  • Thanks @jsulm , the library was likely built with a Visual C++ compiler. So there is no change to include this in my project then?


  • Lifetime Qt Champion

    @SebastianS Not if you want to use MinGW. You either change to same Visual C++ compiler or get this library built with MinGW.



  • @jsulm Ok, I will see if switching to Visual C++ is not too uncomfortable and give it a try. Thanks a lot!


  • Lifetime Qt Champion

    @SebastianS

    Hi. Please notice you will need to download a new Qt for VS. ( match version . 2013 / 2015)

    You can setup Creator to use visual studio as compiler so there be
    no change in that regards.


Log in to reply