简体   繁体   中英

Adding Library to Debug Config - QtCreator, VC Compiler

After adding the libmusicxml library to my project in QtCreator (using the VC 2012 Compiler) the project will compile using the release configuration not however using the debug configuration. In the linking phase a number of build problems concering unresolved external symbols occur.

Having read through other posts I realise that I have to link to the library for both configurations separately. I have tried adding the following variants to my .pro-file without any success.

  • 1

    LIBS += -L$$PWD/../Libraries/libmusicxml-3.00-win32/ -llibmusicxml2

    INCLUDEPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include

    DEPENDPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include`

  • 2

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Libraries/libmusicxml-3.00-win32/ -llibmusicxml2

    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../Libraries/libmusicxml-3.00-win32/ -llibmusicxml2d

    INCLUDEPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include

    DEPENDPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include

  • 3, leaving out the d suffix in line 3

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Libraries/libmusicxml-3.00-win32/ -llibmusicxml2

    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../Libraries/libmusicxml-3.00-win32/ -llibmusicxml2

    INCLUDEPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include

    DEPENDPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include

The error messages look like

main.obj:-1: Fehler:LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual _ thiscall MusicXML2::xmlreader::~xmlreader(void)" ( _imp_??1xmlreader@MusicXML2@@UAE@XZ) referenced in function _main

I hope somebody can help me out, thanks in advance!

In our projects we do it like this:

LIBS += -L$$PWD/../Libraries/libmusicxml-3.00-win32
win32 {
    CONFIG(debug, debug|release) {
        LIBS += -llibmusicxml2d
    } else {
        LIBS += -llibmusicxml2
    }
}
INCLUDEPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include

DEPENDPATH += $$PWD/../Libraries/libmusicxml-3.00-win32/include

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM