简体   繁体   English

如何在 Windows 上正确编译 RtMidi API

[英]How to compile RtMidi API properly on Windows

I'm using C++ on visual studio 2019 and having issues trying to link my project to PortAudio.我在 Visual Studio 2019 上使用 C++ 并且在尝试将我的项目链接到 PortAudio 时遇到问题。 When I use the RtAudio header file in a project, I get the error message "MidiInDummy: This class provides no functionality."当我在项目中使用 RtAudio header 文件时,我收到错误消息“MidiInDummy:此 class 不提供任何功能。” Most solutions I can find online say to add __WINDOWS_MM__ to the pre-processor definitions and link to winmm.lib (as instructed on https://www.music.mcgill.ca/~gary/rtmidi/ ) However, having done this, I am still getting the same problem.我可以在网上找到的大多数解决方案都说将__WINDOWS_MM__添加到预处理器定义中并链接到 winmm.lib(按照https://www.music.mcgill.ca/~gary/rtmidi/上的说明)但是,这样做了,我仍然遇到同样的问题。

I get the error message "MidiInDummy: This class provides no functionality."我收到错误消息“MidiInDummy:此 class 不提供任何功能。”

This warns that no valid MIDI API was defined.这警告没有定义有效的 MIDI API。 The warning is issued from the constructor of the MidiInDummy class in rtMidi.cpp , which is just a placeholder without functional implementation.警告是从 rtMidi.cpp 中的MidiInDummy rtMidi.cpp的构造函数发出的,它只是一个没有功能实现的占位符。

add __WIN_MM__ to the pre-processor definitions__WIN_MM__添加到预处理器定义中

That is the wrong #define for the Windows build, which explains the MidiInDummy warning.这是 Windows 构建的错误#define ,它解释了MidiInDummy警告。 The correct definition, listed on the reference page underCompiling is: 编译下的参考页面上列出的正确定义是:

#define __WINDOWS_MM__

Once __WINDOWS_MM__ is defined, the sample cMidiIn.dsp project builds fine with VS 2019 after fixing a few remaining minor issues:定义__WINDOWS_MM__后,在修复了一些剩余的小问题后,示例cMidiIn.dsp项目可以在 VS 2019 中正常构建:

  • error D8016: '/ZI' and '/Gy-' command-line options are incompatible - change project Properties / C/C++ / General / Debug Information from /ZI to /Zi ; error D8016: '/ZI' and '/Gy-' command-line options are incompatible - 将项目属性/C/C++/常规/调试信息从/ZI更改为/Zi

  • warning D9035: option 'Gm' has been deprecated and will be removed in a future release - change project Properties / C/C++ / Code Generation / Enable Minimal Rebuild from /Gm to /Gm- ; warning D9035: option 'Gm' has been deprecated and will be removed in a future release - 将项目属性/C/C++/代码生成/启用最小重建从/Gm更改为/Gm-

  • warning C4138: '*/' found outside of comment - add a space before /*userData*/ in: warning C4138: '*/' found outside of comment - 在/*userData*/之前添加一个空格:

     void mycallback(double deltatime, std::vector< unsigned char >* message, void* /*userData*/)

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

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