【发布时间】:2017-05-01 01:46:57
【问题描述】:
在 MIDI.h 中定义了一个类库(我不能/不应该更改):
template<class SerialPort, class _Settings = DefaultSettings>
class MidiInterface
{
...
我想用这个类作为参数。 问题question 重复,但我仍然收到编译错误。
我自己的头类文件长这样:
#include <MIDI.h>
class M
{
public:
void setup();
void run();
private:
void printMessage(const MidiInterface<SerialPort, _Settings>&
midiInterface);
};
我收到以下错误:
在草图\M.cpp:1:0: 中包含的文件中:
M.h:10: error: 'MidiInterface' does not name a type
void printMessage(const MidiInterface<SerialPort, _Settings>& midiInterface);
^
M.h:10: error: expected ',' or '...' before '<' token
void printMessage(const MidiInterface<SerialPort, _Settings>& midiInterface);
^
exit status 1
'MidiInterface' does not name a type
如何更改代码以便编译?
【问题讨论】: