ROBOTC.net forums
http://www.robotc.net/forums/

Virtual Worlds
http://www.robotc.net/forums/viewtopic.php?f=66&t=6184
Page 1 of 2

Author:  Jkiss427 [ Sun Jul 07, 2013 6:25 pm ]
Post subject:  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.

Author:  NeXT-Generation [ Sun Jul 07, 2013 6:32 pm ]
Post subject:  Re: Virtual Worlds

Please post your whole code

Author:  parkway [ Sun Jul 07, 2013 6:43 pm ]
Post subject:  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.

Author:  Jkiss427 [ Sun Jul 07, 2013 8:08 pm ]
Post subject:  Re: Virtual Worlds

That is the only thing on those line.

Author:  Jkiss427 [ Sun Jul 07, 2013 8:19 pm ]
Post subject:  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.

Author:  NeXT-Generation [ Sun Jul 07, 2013 8:22 pm ]
Post subject:  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.

Author:  Jkiss427 [ Sun Jul 07, 2013 8:25 pm ]
Post subject:  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)

Author:  NeXT-Generation [ Sun Jul 07, 2013 8:29 pm ]
Post subject:  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.

Author:  Jkiss427 [ Sun Jul 07, 2013 8:37 pm ]
Post subject:  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

Author:  rcahoon [ Sun Jul 07, 2013 8:37 pm ]
Post subject:  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

Author:  Jkiss427 [ Sun Jul 07, 2013 8:40 pm ]
Post subject:  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.

Author:  rcahoon [ Sun Jul 07, 2013 8:59 pm ]
Post subject:  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

Author:  Jkiss427 [ Sun Jul 07, 2013 9:01 pm ]
Post subject:  Re: Virtual Worlds

For some reason I forgot a semicolon, I put that in and it works! :shock: Thanks anyway.

Author:  rcahoon [ Sun Jul 07, 2013 9:28 pm ]
Post subject:  Re: Virtual Worlds

Cool! Glad you got it figured out.

Author:  parkway [ Sun Jul 07, 2013 10:15 pm ]
Post subject:  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.

Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/