Thanks for the info. That looks fine and means the project you sent hadn't yet been saved, I should have mentioned to do that.
So I included your code and tried to compile and could see the following issues in your code.
Here are a few tips:-
The compiler error that I can see is as follows :-
ClassA.cpp.o:In function `ClassA::methodA1()
ClassA.cpp:methodB1()
ClassA.cpp.o:In function `ClassA::methodA2()
ClassA.cpp:methodB2()
collect2.exe*:error: ld returned 1 exit status
Error creating .elf
The error isn't very helpful so I will look into a better message. In fact if you switch on "Visual Micro>Verbose Messages" you get a better error:-
ClassA.cpp:6:20: fatal error: ClassB.h: No such file or directory
:#include "ClassB.h"
:compilation terminated
The error is because you have included the ClassB library in your ClassA code but not in the master .ino.
Historically for Arduino if you want to use any libraries in a project you must include them in the master .ino source.
This area of development is changing at the moment to make it easier for users but this is how it has been for 5+ years
This still applies even if the .ino does not use the "other" library. So I changed your .ino code as follows adding the #include for ClassB:-
#include <ClassA.h>
#include <ClassB.h>
ClassA classA;
void setup() {
classA.methodA1();
}
void loop() {
classA.methodA2();
}
After that fix your code will still fail. Again not great error messages although the Visual Studio intellisense will show the error.
The problem is your ClassB header defines a constructor but the classB.cpp doesn't have one. Remove ClassB(); from the ClassB.h
Incorrect
class ClassB {
public:
ClassB();
void methodB1();
void methodB2();
};
Correct
class ClassB {
public:
void methodB1();
void methodB2();
};
tip: If you switch on "Visual Micro>Compiler Warnings" you get a good error message for the first issue in your code. It's better than Verbose because there is less 'other stuff' in the output