PROS no matching constructor for intitalization of 'okapi::MotorGroup'

I don’t know why I’m getting this error, everything looks identical to working examples of code. Any help would be appreciated.

code

void opcontrol() {
pros::Controller master(pros::E_CONTROLLER_MASTER);

//differential motors, not actual robot code
okapi::Motor differential1(-1);
okapi::Motor differential2(2);
okapi::Motor differential3(-3);
okapi::Motor differential4(4);
okapi::MotorGroup differentialGroup1(differential1, differential3);
okapi::MotorGroup differentialGroup2(differential2, differential4);

differential1.setBrakeMode(okapi::AbstractMotor::brakeMode::coast);
differential2.setBrakeMode(okapi::AbstractMotor::brakeMode::coast);

while (true) {
	//differential code, not actual---------------------------------------------
	if(master.get_digital(DIGITAL_X) == 1) {
		differentialGroup1.moveVoltage(127);
		differentialGroup2.moveVoltage(127);
	}
	else if(master.get_digital(DIGITAL_B) == 1) {
		differentialGroup1.moveVoltage(-127);
		differentialGroup2.moveVoltage(-127);
	}
	else if(master.get_digital(DIGITAL_A) == 1) {
		differentialGroup1.moveVoltage(-127);
		differentialGroup2.moveVoltage(127);
	}
	else if(master.get_digital(DIGITAL_Y) == 1) {
		differentialGroup1.moveVoltage(127);
		differentialGroup2.moveVoltage(-127);
	}
	else {
		differentialGroup1.moveVoltage(0);
		differentialGroup2.moveVoltage(0);
	}
	//end of differential code, not actual--------------------------------------

	pros::delay(20);
}

}

the error also pops up when I build, so I dont think its a linter problem.

You’re passing in the motors as 2 separate parameters, but the MotorGroup constructor requires them to be in an initializer list.

The correct code would be as follows:
okapi::MotorGroup differentialGroup1({differential1, differential3});

3 Likes