Hi,
I noticed you have posted a visual micro verbose output with your question in the arduino.cc forum. That will just cause confusion. My suggestion was to build using the Arduino IDE to confirm the same error then post the verbose output from the Arduino IDE in the Arduino forum. If you don't work that way you won't get any help from the arduino crowd and it is a main point about why Visual Micro remains compatible with the Arduino IDE
So I comment a missing file and it then fails with this error:-
DualMotorRomeo.h:undefined reference to `vtable for DualMotorRomeo
Double clicking the error takes me to the following line which appears to be expecting the static struct defined in BJRobotOptions.h called BJRobotOptions::Settings to be passed by ref.
DualMotorRomeo.h
BJRobotOptions::Settings *settings;
// Constructor
DualMotorRomeo(BJRobotOptions::Settings *s) : settings(s), GenericDualMotor(this, MT_ROMEO) {
_leftMotion = settings->motorPins.leftMotion;
_leftSpeed = settings->motorPins.leftSpeed;
_leftFlip = settings->motorPins.leftFlip;
_rightMotion = settings->motorPins.rightMotion;
_rightSpeed = settings->motorPins.rightSpeed;
_rightFlip = settings->motorPins.rightFlip;
};
GenericMotorDual.h
class MotorDefinition;
class GenericDualMotor : public PropulsionSystem {
protected:
bool validated;
GenericDualMotor *motor;
public:
MotorDefinition *leftMotor;
MotorDefinition *rightMotor;
// Constructor
GenericDualMotor(GenericDualMotor *m, int mType)
: motor(m), PropulsionSystem(PT_DUAL_MOTOR, mType) {
validated = false;
};
// Destructor
virtual ~GenericDualMotor() {};
BJRobotOptions.h
#include "BJRobotSettings.h"
class BJRobotOptions {
public:
#if MOTOR_TYPE == MT_L298N
static struct MT_L298N_PINS {
int MotorType = MOTOR_TYPE;
int IN1 = MT_L298N_IN1;
int IN2 = MT_L298N_IN2;
int ENA = MT_L298N_ENA;
bool FLIPA = MT_L298N_FLIPA;
int IN3 = MT_L298N_IN3;
int IN4 = MT_L298N_IN4;
int ENB = MT_L298N_ENB;
bool FLIPB = MT_L298N_FLIPB;
} motor_L298N;
#elif MOTOR_TYPE == MT_L9110
static struct MT_L9110_PINS {
int MotorType = MOTOR_TYPE;
int PWMA = MT_L9110_PWMA;
int DIRA = MT_L9110_DIRA;
int FLIPA = MT_L9110_FLIPA;
int PWMB = MT_L9110_PWMB;
int DIRB = MT_L9110_DIRB;
int FLIPB = MT_L9110_FLIPB;
} motor_L9110;
#elif MOTOR_TYPE == MT_ROMEO
static struct MT_ROMEO_PINS {
int MotorType = MOTOR_TYPE;
int leftMotion = MT_ROMEO_LEFTMOTION;
int leftSpeed = MT_ROMEO_LEFTSPEED;
bool leftFlip = MT_ROMEO_LEFTFLIP;
int rightMotion = MT_ROMEO_RIGHT_MOTION;
int rightSpeed = MT_ROMEO_RIGHT_SPEED;
bool rightFlip = MT_ROMEO_RIGHT_FLIP;
} motor_ROMEO;
#elif MOTOR_TYPE == MT_ZUMO
static struct MT_ZUMO_PINS {
int MotorType = MOTOR_TYPE;
int leftMotion = MT_ZUMO_LEFTMOTION;
int leftSpeed = MT_ZUMO_LEFTSPEED;
bool leftFlip = MT_ZUMO_LEFTFLIP;
int rightMotion = MT_ZUMO_RIGHT_MOTION;
int rightSpeed = MT_ZUMO_RIGHT_SPEED;
bool rightFlip = MT_ZUMO_RIGHT_FLIP;
} motor_ZUMO;
#else
assert(false);
#endif
// Destructor
~BJRobotOptions() {};
// PIN SETTINGS:
//
// Red signals obstacle very close
// Yellow signals obstacle nearby but not up close and personal...yet
// Green signals no obstacles nearby
// Blue signals command(s) being executed which indicate that the robot is moving.
//
// The associated ranges for these signals can be specified with the pin settings:
struct ObstaclePinSetting {
int pin;
int distance; // in CM
};
static struct ObstaclePinSettings {
ObstaclePinSetting redPin;
ObstaclePinSetting yellowPin;
ObstaclePinSetting greenPin;
ObstaclePinSetting bluePin;
} obstaclePinSettings;
// One ring to rule them all... this struct contains ALL settings values
struct Settings {
int CompassType;
int OutputOptions;
ObstaclePinSettings *pins;
#if MOTOR_TYPE == MT_L298N
struct MT_L298N_PINS motorPins;
#elif MOTOR_TYPE == MT_L9110
struct MT_L9110_PINS motorPins;
#elif MOTOR_TYPE == MT_ROMEO
struct MT_ROMEO_PINS motorPins;
#elif MOTOR_TYPE == MT_ZUMO
struct MT_ZUMO_PINS motorPins;
#endif
} settings;
bool init(Settings *settings);
const char* getMotorType(int mType);
const char* getCompassType(int cType);
private:
bool _initialized = false;
};
#endif
In all of this you have some static, some objects and inheritance.
I have explained previously that I need to keep this forum for support of the plugin for Visual Studio and Atmel Studio. I don't make money from selling hardware and am one person when the arduino forum is many people. Therefore for problems in code, to prevent me from being drowned with unrelated requests, I ask that help with code is found from the many other places on the web.
These other "places" for support will not be as forgiving as me. Posting a verbose output on it's own without showing or giving overview of the code, as I have done above, will not allow people to help you.
You should make a cut down test of what you are trying to achiever. You create BJOptions/settings in the .ino. Later you try to use the settings in a call to a method in a semi-static inherited environment. I don't see how any of your previous reports about this show the issue.
In addition to making better reports I also ask that when you provide examples that you have tested them yourself and informed helpers like myself which libraries need to be installed. It needed TimerOne
Quote:Comment out line 66 in CommandPattern.ino. BJMotionDetector is a stub for the next bunch of code I want to add, but it compiles fine without this file included
Do you mean the compile problem you have reported shows when BJMotionDetector.h is commented out? If so then I agree with you.
Lastly I have said before that my knowledge it limited however I see you are expecting a constructor in a class to be used in static way and the constructor is doing some complex stuff with objects and inheritance. I don't know when you expect things to be initialized in this usage? When do you create the non-static objects?