Reputation: 177
I’m using C++ on visual studio 2019 and having issues trying to link my project to PortAudio. When I use the RtAudio header file in a project, I get the error message "MidiInDummy: This class provides no functionality." 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.
Upvotes: 1
Views: 1396
Reputation: 329
Instead of defining __WINDOWS_MM__
directly on the .cpp
files, you can define it in CMakeLists.txt
instead like this:
# Specify the executable name accordingly to the OS
if (WIN32) # LINUX is new for CMake VERSION 3.25
set(EXECUTABLE_NAME "MidiInDummy")
add_compile_definitions(__WINDOWS_MM__)
else()
set(EXECUTABLE_NAME "MidiInDummy.out")
endif()
Upvotes: 0
Reputation: 17668
I get the error message "MidiInDummy: This class provides no functionality."
This warns that no valid MIDI API was defined. The warning is issued from the constructor of the MidiInDummy
class in rtMidi.cpp
, which is just a placeholder without functional implementation.
add
__WIN_MM__
to the pre-processor definitions
That is the wrong #define
for the Windows build, which explains the MidiInDummy
warning. The correct definition, listed on the reference page under Compiling 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:
error D8016: '/ZI' and '/Gy-' command-line options are incompatible
- change project Properties / C/C++ / General / Debug Information from /ZI
to /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 C4138: '*/' found outside of comment
- add a space before /*userData*/
in:
void mycallback(double deltatime, std::vector< unsigned char >* message, void* /*userData*/)
Upvotes: 3