Here's the file where in which I try to instantiate the "Melodie" object:
#include <Melodie.h>
Melodie<5> m(8);
void setup()
{
}
void loop()
{
}
Here's the "Melodie.h" file:
#ifndef Melodie_H
#define Melodie_H
#include <Arduino.h>
#include "pitches.h"
template <int NB_NOTES>
class Melodie
{
public:
Melodie(int pin)
{
// Some unimportant stuff
}
void addNote(int pitch, int duration)
{
// Some unimportant stuff
}
void play()
{
// Some unimportant stuff
}
private:
char notes_[NB_NOTES];
char durations_[NB_NOTES];
int notePointer_;
int pin_;
};
#endif
I get the following error message: error: expected constructor, destructor, or type conversion before '<' token
Why? The same code works(minus arduino specific stuff) works in Visual Studio. I thought WinAVR supported C++?
Melodie<5> m(8);
. Looking for an answer to this question as well. – Zak