Log in

View Full Version : C++ Code Not working


tig567899
09-01-2016, 21:23
I started a new code using c++, and I keep getting the error 'Invalid arguments' on the line:

START_ROBOT_CLASS(Robot);

Has someone experienced the same problem? Thanks.

calcmogul
09-01-2016, 22:13
Is that error being shown by the Eclipse indexer, the build console, or both? Did you start from an example project, and if so, which was it?

RufflesRidge
10-01-2016, 00:24
I started a new code using c++, and I keep getting the error 'Invalid arguments' on the line:

START_ROBOT_CLASS(Robot);

Has someone experienced the same problem? Thanks.

Did you do the step "Rebuilding the index"?

http://wpilib.screenstepslive.com/s/4485/m/13810/l/145319-creating-your-benchtop-test-program

ETGH
10-01-2016, 14:51
We are having the same problem - and rebuilding the index doesn't fix it. Any other suggestions?

calcmogul
10-01-2016, 15:06
I've found the indexer to not be the ultimate authority on whether one's C++ code compiles. Try building the project and seeing if that error prints in the build console as well. If it doesn't and the build succeeded, you can ignore the indexer.

tig567899
12-01-2016, 11:40
The error is in the "Problems tab" on eclipse, and prevents the thing from building. I've tried rebuilding, and the problem occurs on every type of robot program (sample, iterative, example robot program).

DamenStar
12-01-2016, 14:50
Normally the START_ROBOT_CLASS(Robot) statement should sit outside the main class normally in Robot.cpp. It should be located outside of any defined method:

#include "WPILib.h"
#include "Robot.h"

OI * Robot::oi = NULL;
DriveBase * Robot::drivebase = NULL;

void Robot::RobotInit(){
oi = new OI();
drivebase = new DriveBase();

}

START_ROBOT_CLASS(Robot);

It would be great if you post your code that you are having a problem with.

See ya in the bitstream

tig567899
14-01-2016, 09:38
I have screenshotted the thing but this forum doesn't let me post the image.

The code is below:

#include "WPILib.h"

class Robot: public IterativeRobot
{
private:

void RobotInit()
{
}

void AutonomousInit()
{

}

void AutonomousPeriodic()
{

}

void TeleopInit()
{

}

void TeleopPeriodic()
{

}

void TestPeriodic()
{

}

};

START_ROBOT_CLASS(Robot);



The error is: Invalid arguments', line 38, which is the START_ROBOT_CLASS(Robot); line.