MIDIDeviceController.h causes compiler errors

The file MIDIDeviceController.h, (from the MIDIDevice plugin) when included, results in a compiler error:

CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.14\Engine\Plugins\Runtime\MIDIDevice\Source\MIDIDevice\Public\MIDIDeviceController.h(80) : error C2143: syntax error: missing ';' before '*'C:\Program Files\Epic Games\4.14\Engine\Plugins\Runtime\MIDIDevice\Source\MIDIDevice\Public\MIDIDeviceController.h(80): error C2143: syntax error: missing ';'
 before '*'
CompilerResultsLog: Info 
CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.14\Engine\Plugins\Runtime\MIDIDevice\Source\MIDIDevice\Public\MIDIDeviceController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-intC:\Program Files\Epic Games\4.14\Engine\Plugins\Runtime\MIDIDevice\Source\MIDIDevice\Public\MIDIDeviceController.h(80)
: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
CompilerResultsLog: Info 
CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.14\Engine\Plugins\Runtime\MIDIDevice\Source\MIDIDevice\Public\MIDIDeviceController.h(80) : error C2238: unexpected token(s) preceding ';'C:\Program Files\Epic Games\4.14\Engine\Plugins\Runtime\MIDIDevice\Source\MIDIDevice\Public\MIDIDeviceController.h(80): error C2238: unexpected token(s) precedin
g ';'

The source file is totally unmodified - this happens out of the box. This makes working with MIDI devices in C++ impossible, as the MIDIDeviceController is used to interface with the devices.

EDIT: Some extra information that may or may not help:

I’ve added "MIDIDevice" to my PublicDependencyModuleNames line in my Build.cs, in the same way you add any plugin. I’m able to import MIDIDeviceManager.h without error with that added.

With further digging around, the particular line that has an error is PortMidiStream* PMMIDIInputStream; - the error is that PortMidiStream is not specified. I assume this specification is done in the portmidi.h file, which is included in the MIDIDevice plugin’s pre-compiled header. IntelliSense is giving me the -squiggle, saying that it cannot open that header file.

I assumed that maybe I had to do something extra to make sure this third-party dependency worked. I’ve tried using methods described in these AnswerHub threads, but to no avail.

Hello ,

Have you tried doing this inside of a fresh project? I created a new C++ project based off the Third Person Template, enabled the MIDIDeviceController plugin, added a C++ class based off of actor, and then included the MIDIDeviceController.h using the following include statement and it compiled without any errors for me.

#include "Engine/Plugins/Runtime/MIDIDevice/Source/MIDIDevice/Public/MIDIDeviceController.h"

Please give this a try and let me know if you receive any errors.

I tried that include on my project, but got a compile error claiming there was no such file or directory. I tried on a new Third Person C++ project, and got the same error.

Right now I’m importing the header by adding "MIDIDevice" to the PublicDependencyModuleNames line in my Build.cs file, which allows me to include MIDIDeviceManager.h without error, as well as include MIDIDeviceController.h with the bug given above - the compiler does find the file, just with an error. This works both on my current project as well as the default Third Person C++ project.

I’ll try re-installing 4.14.1 and see if anything changes.

Update: Re-installed 4.14.1, and both errors persist, even on another newly created Third Person C++ project.

Excellent! Thank you, I look forward to hearing back :slight_smile:

Ah, I’m seeing the issue now after including the module. I also can’t get it to include that file again without including the module. Not quite sure how it was working previously. I do see that MIDIDeviceController.cpp does have a couple of "int"s in it but those aren’t exposed to blueprints so they should be fine. I’m going to look into this further and get back to you.

After looking at the source code and the commit messages of when this plugin was added to the engine, it may be that this plugin is only meant to be implemented in Blueprint at the moment. I’m going to ask to person who created it to be sure but I won’t be able to contact them until after the holiday break. I’ll have an update for you shortly into the new year.

Hello ,

I spoke with the person who created this plugin and they mentioned that while it isn’t intended to only be used in Blueprints, that’s all it was tested for and it was never tested in an external module. Due to this, I’ve placed a bug report in for the issue. You can find that bug here: UE-40704

Thank you for reporting this issue and have a nice day!

Thanks for the help!