我正在关注https://www.music.mcgill.ca/~gary/rtmidi/的基本教程,我似乎无法超越“#34;入门”中的第一步。"
最初我只收到两个错误,其中一个是" LNK2019 - 未解析的外部符号"错误,我通过链接rtmidi.lib和rtmidid.lib
来修复现在我有一大堆错误,我无法理解
rtmidi.lib(RtMidi.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
RTMIDI_test.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RTMIDI_test.obj
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in RTMIDI_test.obj
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInUnprepareHeader@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInOpen@20
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutGetDevCapsW@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutPrepareHeader@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutOpen@20
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInReset@4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInPrepareHeader@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutUnprepareHeader@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInGetDevCapsW@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInStart@4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInClose@4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInAddBuffer@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInGetNumDevs@0
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutShortMsg@8
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutGetNumDevs@0
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutLongMsg@12
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutClose@4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInStop@4
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiOutReset@4
C:\Users\Zach\Desktop\RTMIDI_test\Debug\RTMIDI_test.exe : fatal error LNK1120: 19 unresolved externals
显然,在第7-25行,它正在寻找一个不存在的图书馆或其他东西,但没有提供它的含义。然而,其余的,我甚至无法弄明白。任何想法?
我在其他地方读到了将项目选项更改为"发布"哪个摆脱了上述消息,而是用
替换它们RTMIDI_test.obj : error LNK2001: unresolved external symbol "public: __thiscall RtMidiIn::RtMidiIn(enum RtMidi::Api,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int)" (??0RtMidiIn@@QAE@W4Api@RtMidi@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z)
C:\Users\Zach\Desktop\RTMIDI_test\Release\RTMIDI_test.exe : fatal error LNK1120: 1 unresolved externals
答案 0 :(得分:2)
大多数链接错误都告诉您需要做些什么来解决它们(至少结合一点谷歌搜索)
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in RTMIDI_test.obj
rtmidi.lib(RtMidi.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in RTMIDI_test.obj
因此RTMIDI_test.cpp
编译的_ITERATOR_DEBUG_LEVEL
值与rtmidi.lib
的值不同。下一行说您正在尝试将调试项目与rtmidi.lib
的发布版本链接起来。您应该将其更改为与调试版本链接,而不应删除部分或全部其他警告和错误。
rtmidi.lib(RtMidi.obj) : error LNK2001: unresolved external symbol __imp__midiInUnprepareHeader@12
midiInUnprepareHeader
以及其他midiIn*
函数位于winmm.lib
(请参阅docs),因此您还需要将其与此相关联。