Go to Post Corn dogs for everyone! - DCA Fan [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-01-2015, 14:09
VD3626 VD3626 is offline
Registered User
FRC #3626
 
Join Date: Jan 2015
Location: Texas
Posts: 6
VD3626 is an unknown quantity at this point
Robot Builder Generating Code with Errors in it

I generated this code in Robot builder and then imported it into eclipse and hit build. The Code had errors in the robot.h file and the motor.h file (motor.h is in the subsystem folder as the only system I am currently trying to test)

robot.h:
Code:
// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// C++ from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


#ifndef _ROBOT_H
#define _ROBOT_H

#include "WPILib.h"
#include "Commands/Command.h"
#include "RobotMap.h"
#include "LiveWindow/LiveWindow.h"

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=INCLUDES
#include "Commands/AutonomousCommand.h"
#include "Subsystems/motor.h"

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=INCLUDES
#include "OI.h"

class Robot : public IterativeRobot {
public:
	Command *autonomousCommand;
	static OI *oi;
	LiveWindow *lw;
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	static motor* motor;
	// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	virtual void RobotInit();
	virtual void DisabledInit();
	virtual void DisabledPeriodic();
	virtual void AutonomousInit();
	virtual void AutonomousPeriodic();
	virtual void TeleopInit();
	virtual void TeleopPeriodic();
	virtual void TestPeriodic();
};
#endif
In line 33:
Code:
static motor* motor;
I get the error message: declaration of 'motor* Robot::motor' [-fpermissive]

motor.h:
Code:
// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// C++ from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


#ifndef MOTOR_H
#define MOTOR_H
#include "Commands/Subsystem.h"
#include "WPILib.h"

/**
 *
 *
 * @author ExampleAuthor
 */
class motor: public Subsystem {
private:
	// It's desirable that everything possible under private except
	// for methods that implement subsystem capabilities
public:
	// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	SpeedController* talon;
	// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	motor();
	void InitDefaultCommand();
};

#endif
In line 22:
Code:
class motor: public Subsystem {
I get the error message: changes meaning of 'motor' from 'class motor' [-fpermissive]

I can tell that these errors are related and that if I resolve one it will probably resolve the other as well but I do not understand what is wrong and do not know what to do. Any help is appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 10-01-2015, 16:25
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Robot Builder Generating Code with Errors in it

RobotBuilder was designed with the naming conventions delineated here: https://wpilib.screenstepslive.com/s...s#!prettyPhoto

In particular, since your motor class is lower case rather then first letter upper case, it's trying to declare an instance variable with the same name as the class. Delete the motor.cpp and .h and change your subystem name to Motor and clean and rebuilt and it should work.

In general, motor is probably not a good subsystem name. It should be tied to something unique and memorable piece of your robot, like DriveTrain, Arm, Stacker, or something like that. More ideas here: http://wpilib.screenstepslive.com/s/...ed-programming
Reply With Quote
  #3   Spotlight this post!  
Unread 10-01-2015, 17:53
VD3626 VD3626 is offline
Registered User
FRC #3626
 
Join Date: Jan 2015
Location: Texas
Posts: 6
VD3626 is an unknown quantity at this point
Re: Robot Builder Generating Code with Errors in it

Thank you that fixed it.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi