Hi,
I've been trying to create a library class, and I get a compile error in the sketch when trying to access members of an instance, wich class has a no-arg constructor.
This is the library class, wich I've put in the hardware\libraries dir as usual:
This is Test.h:
#ifndef Test_h
#define Test_h
#include "WProgram.h"
class Test
{
public:
int testVar;
Test();
void testMethod();
};
#endif
This is Test.cpp:
#include "WProgram.h"
#include "Test.h"
Test::Test()
{
testVar = 1;
}
void Test::testMethod()
{
testVar = 2;
}
And this is the sketch testing the Test class:
#include <Test.h>
void setup() {
Test myTest();
myTest.testVar = 34;
myTest.testMethod();
}
void loop() {
}
When compiling the sketch, the compiler says:
In function 'void setup()':
error: request for member 'testVar' in 'myTest', wich is of non-class type 'Test ()()'This happens when accessing the member variable or the method.
But, when adding an integer parameter to the constructor, it compiles nicely. I suppose that it's a bug, because no-arg constructor should be allowed, isn't it?
Thanks in advance
I forgot to mention that I'm using compiler version 0017