I am trying to compile a program but the identifier which is identified in robot-config.cpp is marked unidentified and if I define it in the main file, it counts as a double definition error. How can I resolve this issue. Thanks!
can you provide a few more details ?
Was this defined using graphical configuration ? or is it a variable ? instance of a class (eg. a motor) ?
perhaps paste the error message from VEXcode here.
I defined it in the graphical configuration. Specifically it is a inertial sensor part of a drive train. The name that the graphical configuration set “DrivetrainInertial” in robot-config.cpp is the same as what is called in main.cpp. The error is:
use of undeclared identifier 'DrivetrainInertial'
Can you post the code from robot-config.cpp and maybe a screenshot from your graphical configuration?
If you have a configuration something like this.
Then to access that instance in main.cpp, you would add a definition like this.
#include "vex.h"
using namespace vex;
extern inertial DrivetrainInertial;
int main() {
// as an example...
DrivetrainInertial.calibrate();
}
Thank you, this information helps significantly.