Thread: C++ Errors
View Single Post
  #3   Spotlight this post!  
Unread 30-01-2015, 17:25
catacon catacon is offline
Registered User
FRC #1444 (Lightning Lancers)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2006
Location: St. Louis
Posts: 154
catacon is a splendid one to beholdcatacon is a splendid one to beholdcatacon is a splendid one to beholdcatacon is a splendid one to beholdcatacon is a splendid one to beholdcatacon is a splendid one to beholdcatacon is a splendid one to behold
Re: C++ Errors

Quote:
Originally Posted by pntbll1313 View Post
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);
                }
            }
        };

Last edited by catacon : 30-01-2015 at 17:30.
Reply With Quote