Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   General Forum (http://www.chiefdelphi.com/forums/forumdisplay.php?f=16)
-   -   C++ Errors (http://www.chiefdelphi.com/forums/showthread.php?t=133724)

FRC2501 30-01-2015 16:30

C++ Errors
 
#include "WPILib.h"
#include<time.h>

class Robot : public SampleRobot
{
private:
Talon talon;
Jaguar jaguar;
public:
Robot() :
talon(1),
jaguar(2)
{

}
void Autonomous()
{
Wait(2.0);
}
void OperatorControl()
{
while (IsOperatorControl() && IsEnabled())
{
talon.Set(1);
Wait(1.0);
}
}
};

START_ROBOT_CLASS(Robot);

Why are the errors here? Help!

nighterfighter 30-01-2015 16:54

Re: C++ Errors
 
Why is what where?

FRC2501 30-01-2015 16:55

Re: C++ Errors
 
Quote:

Originally Posted by nighterfighter (Post 1436268)
Why is what where?

There were a lot of errors

nighterfighter 30-01-2015 16:56

Re: C++ Errors
 
Quote:

Originally Posted by FRC2501 (Post 1436269)
There were a lot of errors

What did they say?

pntbll1313 30-01-2015 17:04

Re: C++ Errors
 
Sorry if this is dumb (I'm not a C++ guy), but do you need a semicolon after your robot definition?

Robot() :
talon(1),jaguar(2)
{
}

I'm unclear if this is your entire code, a section that you think is giving the error, or you've removed some of the code. Posting the errors you get will probably help smarter programmers than I :)

wireties 30-01-2015 17:16

Re: C++ Errors
 
please post the compiler error output

catacon 30-01-2015 17:25

Re: C++ Errors
 
Quote:

Originally Posted by pntbll1313 (Post 1436274)
Sorry if this is dumb (I'm not a C++ guy), but do you need a semicolon after your robot definition?

Robot() :
talon(1),jaguar(2)
{
}

I'm unclear if this is your entire code, a section that you think is giving the error, or you've removed some of the code. Posting the errors you get will probably help smarter programmers than I :)

This is correct. He is using an initialization list to initialize the Talon and Jaguar members.

OP, since you gave us no information on what errors you are encountering, it's near impossible for us to give you any useful advice. However, I'm going to guess you didn't rebuild the index for a new project. Try that and see if it fixes your errors (whatever they may be). Let's see if my crystal ball still works....

Code:

        class Robot : public SampleRobot
        {
            private:
                Talon talon;
                Jaguar jaguar;
            public:
                Robot() :
                    talon(1),
                    jaguar(2)
                {

                }

            void Autonomous()
            {
                Wait(2.0);
            }
            void OperatorControl()
            {
                while (IsOperatorControl() && IsEnabled())
                {
                    talon.Set(1);
                    Wait(1.0);
                }
            }
        };


FRC2501 30-01-2015 17:27

Re: C++ Errors
 
Quote:

Originally Posted by catacon (Post 1436288)
This is correct. He is using an initialization list to initialize the Talon and Jaguar members.

OP, since you gave us no information on what errors you are encountering, it's near impossible for us to give you any useful advice. However, I'm going to guess you didn't rebuild the index for a new project. Try that and see if it fixes your errors (whatever they may be). Let's see if my crystal ball still works....

Sorry, (never let a freshman post for you)
I fixed this by making a new project (apparently it doesn't like that project name)
:ahh:


All times are GMT -5. The time now is 21:03.

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