In Arduino IDE I can create variables with custom types, but cannot return custom type from function:
This compiles
struct Timer
{
Timer()
{
}
};
Timer t;
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
int main()
{
return 0;
}
This creates Timer does not name a type
error:
struct Timer
{
Timer()
{
}
};
Timer get_timer()
{
return Timer();
}
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
int main()
{
return 0;
}
Both compile in Orwell Dev-Cpp
I use MEGA-2560
Timer()
is supposed to denote? A constructor? In a structure? This is not C. – Eugene Sh.