C++ Undefined reference to MIDI function

浪尽此生 提交于 2019-12-02 10:29:00

You need to link with with winmm.lib. In Visual Studio, you do this by adding it to the Additional Dependencies in your project properties.

Right-click on the project, select Properties, then Linker, then Input. Add winmm.lib to the list of files in Additional Dependencies.

Edit: just noticed you are using GCC. In this case, maybe the solution linked in the comments would be better. Add #pragma comment(lib, "winmm.lib") after your headers.

If you do take a look at midiInGetNumDevs you will see that it requires Winmm.lib. You will need to add it to your projects so that the function can get linked to it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!