C++ Undefined reference to MIDI function
I simply want to print the amount of connected MIDI inputs. What in the world am I doing wrong? Using Code::Blocks and GNU GCC Compiler. #include <windows.h> #include <mmsystem.h> #include <stdio.h> int main() { printf("%d", midiInGetNumDevs()); return 0; } I get undefined reference to `midiInGetNumDevs@0' upon compiling. midiInGetNumDevs 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