Nope. Same error: 'TYPE' does not name a type.
My sketch:
template<class TYPE> TYPE Add(TYPE n1, TYPE n2);
TYPE Add(TYPE n1, TYPE n2)
{
TYPE result;
result = n1 + n2;
return result;
}
void setup()
{
float x = 2.1;
float y = 5.6;
Serial.begin(115200);
Serial.println(Add(x, y));
}
void loop()
{
}
The error is at line 3. I was mistaken in my first post. The error was in the same place as indicated this time. I'm using a Mega1280 & IDE1.0.2. Any further thoughts/ideas. As I stated above I can get this to compile using atmel studio. It's just easier to do short code tests using the arduino IDE.
Thanks again for any help,
DJ