View unanswered posts | View active topics It is currently Wed Sep 17, 2014 11:39 am






Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Virtual Worlds 
Author Message
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Virtual Worlds
when I try to do the moving forward part in the labyrinth program it doesn't recognize
Code:
{
and
Code:
}
. Please help me.


Sun Jul 07, 2013 6:25 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Virtual Worlds
Please post your whole code

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Sun Jul 07, 2013 6:32 pm
Profile WWW
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post Re: Virtual Worlds
Yeah, please post your entire code. Your error statements may be on those lines, but the curly braces may not be the issue. Please post your code and we'll see what we can do to help.


Sun Jul 07, 2013 6:43 pm
Profile
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Virtual Worlds
That is the only thing on those line.


Sun Jul 07, 2013 8:08 pm
Profile
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Virtual Worlds
parkway wrote:
Yeah, please post your entire code. Your error statements may be on those lines, but the curly braces may not be the issue. Please post your code and we'll see what we can do to help.


When I try to Compile and Download, I get error messages regarding the lines with the curly braces. What I am trying to complete is the labyrinth. I follow the videos but the error messages keep popping up.


Sun Jul 07, 2013 8:19 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Virtual Worlds
No, we need all the code you have in your file. If your entire code is just
Code:
{
}


Then you're missing a LOT of stuff.

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Sun Jul 07, 2013 8:22 pm
Profile WWW
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Virtual Worlds
No. I put the moving forward code in. And when I try to compile and download. It gives me error messages on those lines only. (That was the only code I could put. I'm right now on the mobile app)


Sun Jul 07, 2013 8:25 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Virtual Worlds
Well as soon as you can, past in the whole code. Everything. The entirety of the file. Heck, upload the file if you feel like it. It's probably a formatting error or something, but we need to see the whole program to be of any use.

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Sun Jul 07, 2013 8:29 pm
Profile WWW
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Virtual Worlds
This is what comes up. (this is not a code)

**Error**:Executable statements not valid in 'main' declaration block
**Error**:Executable statements not valid in 'main' declaration block
**Error**:Unexpected '}' during parsing


Sun Jul 07, 2013 8:37 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Tue Oct 09, 2012 10:34 am
Posts: 192
Post Re: Virtual Worlds
In general, the C language doesn't care about line breaks, and instead uses semicolons to mark the end of statements. We put in line breaks when we write code to make it easier for us and other programmers to read, but many C programs could technically be written on a single line.

Thus, if you have a missing bit of syntax on one line, the ROBOTC compiler will continue on to the next lines until it reaches something that definitely tells it that it's not going to be able to make sense of the program, and only then will it report the syntax error.

tl;dr if you get a syntax error but can't find anything wrong with that line, try looking at the preceding lines. This is also why we need you to post the code for your entire program in order to help you find the problem.

Cheers,
--Ryan

_________________
Ryan Cahoon
CMU Robotics Academy
RVW Software Developer

Robot Potato Head; Virtual NXT


Sun Jul 07, 2013 8:37 pm
Profile
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Virtual Worlds
rcahoon wrote:
In general, the C language doesn't care about line breaks, and instead uses semicolons to mark the end of statements. We put in line breaks when we write code to make it easier for us and other programmers to read, but many C programs could technically be written on a single line.

Thus, if you have a missing bit of syntax on one line, the ROBOTC compiler will continue on to the next lines until it reaches something that definitely tells it that it's not going to be able to make sense of the program, and only then will it report the syntax error.

tl;dr if you get a syntax error but can't find anything wrong with that line, try looking at the preceding lines. This is also why we need you to post the code for your entire program in order to help you find the problem.

Cheers,
--Ryan

I'm sorry but I don't understand that. I'm only a beginner. This is my first year with RobotC.


Sun Jul 07, 2013 8:40 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Tue Oct 09, 2012 10:34 am
Posts: 192
Post Re: Virtual Worlds
rcahoon wrote:
tl;dr if you get a syntax error but can't find anything wrong with that line, try looking at the preceding lines. This is also why we need you to post the code for your entire program in order to help you find the problem.


As simple as I can make it: if ROBOTC says you have a problem on one line, sometimes the problem may actually be somewhere else in the program.

We'll be happy to help you find the problem if you post in your entire program.

Instructions:
Go to ROBOTC, select all your code (press Control-A if you want the shortcut). Select Edit>>Copy from the menu. Come back to this forum thread, click the Post Reply button. Paste the code into the reply box by pressing Control-V (Cmd-V on Apple computers). Select all the code you just pasted into the reply box. Click the Code button that's just above the reply box (this will add [code][/code] tags to format the code nicely so we can read it more easily). Press the Submit button.

Best,
--Ryan

_________________
Ryan Cahoon
CMU Robotics Academy
RVW Software Developer

Robot Potato Head; Virtual NXT


Sun Jul 07, 2013 8:59 pm
Profile
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Virtual Worlds
For some reason I forgot a semicolon, I put that in and it works! :shock: Thanks anyway.


Sun Jul 07, 2013 9:01 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Tue Oct 09, 2012 10:34 am
Posts: 192
Post Re: Virtual Worlds
Cool! Glad you got it figured out.

_________________
Ryan Cahoon
CMU Robotics Academy
RVW Software Developer

Robot Potato Head; Virtual NXT


Sun Jul 07, 2013 9:28 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post Re: Virtual Worlds
Jkiss427 wrote:
For some reason I forgot a semicolon, I put that in and it works! :shock: Thanks anyway.

There you go. Remember, most compiler errors (red X's) are due to syntax errors. Missing semicolons and incorrect capitalization being two of the bigger culprits.


Sun Jul 07, 2013 10:15 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 16 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.