简体   繁体   English

将库添加到调试配置 - QtCreator,VC编译器

[英]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. 在QtCreator中将libmusicxml库添加到我的项目后(使用VC 2012编译器),项目将使用发布配置进行编译,但不使用调试配置。 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. 我尝试将以下变体添加到我的.pro文件中但没有成功。

  • 1 1

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

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

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

  • 2 2

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

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

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

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

  • 3, leaving out the d suffix in line 3 3,省略第3行的d后缀

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

    else:win32:CONFIG(debug, 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 INCLUDEPATH + = $$ PWD /../ Libraries / libmusicxml-3.00-win32 / include

    DEPENDPATH += $$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 main.obj:-1:Fehler:LNK2019:未解析的外部符号“__declspec(dllimport)public:virtual _ thiscall MusicXML2 :: xmlreader :: ~xmlreader(void)”( _imp _ ?? 1xmlreader @ MusicXML2 @@ UAE @ XZ)引用在函数_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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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