What is this error when compiling in Xcode?

what?!?! why am i getting this. /Users/evan/Projects/Flash Games 2/Flash Games.applescript:1: A unknown token can’t go here. (-2740)

i didnt change anything since the last time i compiled it, and now its not working. any ideas?

What token can’t go where?

thats what i’m asking!!! lol, thats the error xcode is giving me…

Well, I wouldn’t I know, because I can’t see your code. :expressionless:

That 1 on the ends means the error occurred on the first line.

yeah i know, but the first line of the script is commented out, its “Flash Games.applescript” would that be causing the problem. should i copy and paste the entire script here?

The first line of actual script; the compiler doesn’t care about comments.

ok, heres the first couple of lines…

on clicked theObject
	set theSelectedRow to the selected data row of table view 1 of scroll view 1 of window "index"
	set theGame to contents of data cell 1 of theSelectedRow
	set this_app to path to me as string
	set this_app to POSIX path of result

This is not entirely true. Comments are ignored during compile, but line numbering is preserved when reporting build errors. (As the compiler walks your source, it ignores comments, but if the comment is malformed, the compiler will assume it’s looking at a token of some sort.)

You can test this with the following two (differently broken) pieces of code:

- test comment

on clicked theObject
end clicked

The above will throw an error on line 1, according to the compiler.

-- test comment

- on clicked theObject
end clicked

While this second example will error on line 3. As you can see, the compiler takes into account the comment and the whitespace when reporting which line it failed on. (Otherwise, it would be ridiculously difficult to debug compile-time errors.)

fiftyfour: Please post the very first line of the script that does not build properly.

the first line is flash games.applescript

i dont really care anymore, what i did was just copy the scripts into a new xcode project and it worked, so its ok now. thanks.

You really need to me more thorough, clear, and specific in your posts. Was the line:

flash games.applescript

or

-- flash games.applescript

Or something else?

Good to see you don’t care about figuring out what you did wrong! What are you going to do when you run into this problem in the future, with a larger, more complex project where this “solution” is a pain in the ass? What about future scripters who may run into your problem and decide to search the Web for solutions, only to find this derelict thread where you “don’t really care”?

Please don’t start threads you aren’t interested in seeing through. It doesn’t help anyone–you, the people who take their time to help you, or others who search the forums.

ok if it’ll make you happy, we’ll fix it. the line is

–flash games.applescript

I guess you don’t really get what I’m saying.

Anyway:

Obviously, that line looks okay. (Barring anything that doesn’t translate well through the forums, like null characters sitting somewhere they shouldn’t.) If you remove the line entirely, does it compile?

still doesnt compile. i removed every commented line so the first line was on clicked theObject and i get the same error.

When you removed the comments, what error did you get during compile?

You might end up having to post the whole script, in the end.

i got the exact same error, as in the first post. i dont think its the code, cuz the exact same script compiled in a new xcode project.

I’ve had a similar issue with xcode. Also when copy and pasting all in a new project it worked fine. I guess there is a little but obnoxious bug somewhere…

It might be a bug, in which case it should be reported to Apple. Can you host a copy of the project somewhere to download?

my sites FTP server is down, so i up’ed it to rapidshare

http://rapidshare.com/files/23986762/Flash_Games_2.zip.html

I’ve run into a problem similar to this before, and one cause that was difficult to track down was that there were hidden characters in the code that had come from cut & pasted text from the web. I’m not sure why you might have cut&pasted a comment into your project, but perhaps there was some other text in there and when you deleted it there were some hidden characters in there that you missed. One website I frequent for sample code is a japanese site, and if I’m not careful about only copying certain text, I sometimes get characters in there that are using some japanese encoding. These hidden characters throw wacky errors and since you can’t see the characters it’s not easy to know how or where to delete them from. Usually if I COMPLETELY DELETE and manually rewrite every line anywhere near the problem, it solves the problem. If cut & pasting the same exact code into a different project worked for you, this is probably not the cause of your problem, though.

j

:slight_smile:

  1. Get info on the script that is throwing the build error.

  2. Change its encoding from UTF-16 to UTF-8.

  3. When prompted to Reinterpret, Cancel, or Convert the text of the script, click Convert.

  4. Clean your project and click build.

And now we have one cause of this problem nailed down (the OSA compiler probably can’t interpret UTF-16 characters correctly), as well as its resolution. The question is . . . how did the encoding get set to UTF-16 in the first place? I’m not certain this is normal behaviour, but I can’t say that it isn’t, either.