views:

153

answers:

2

Hello, I am working on a simple project in Objective-C in Xcode and I'm getting some stray/ errors about the following line of code:

if(celsius < −273.15) {
        NSLog(@"It is impossible to convert temperatures less than −273.15 degrees Celsius, because this is absolute zero, the coldest possible temperature.");
    }

It's actually only about the first line, but I wanted to give some context.

Any suggestions?

I've looked it up here on SO, but everyone else's error hasn't had such simple code like mine, although it appears they have a common problem of having the wrong encoding for certain punctuation, perhaps?

It's got to be just some syntax this on my if statement..

UPDATE:

It looks as though it also displays 2 other stray errors:

Stray '\210' Stray '\222'

+2  A: 

− != -

Your minus, isn't a minus.

Joshua Weinberg
Oh wow, thanks, sorry for wasting your time, what did the compiler recognize mine as?
BOSS
Looks like yours is a 'minus sign' whereas the compiler expects a 'hyphen-minus'.
Joshua Weinberg
Cool, thanks, when I use this code however: if(celsius < -!=-273.15), I get the following error, except only 1 this time, no stray: error: expected expression before '!=' token
BOSS
if(celsius < -!=-273.15) that expression makes no sense. You mean if(celsius < -273.15)?
Joshua Weinberg
Yeah, that's what I had the first time, when I got the stray errors..
BOSS
Copy this directly..if (celsius < -273.15)And fix the encoding on your file
Joshua Weinberg
Wait, sorry, I see what you mean the first time, my bad, I just copied and pasted your last comment and it worked perfectly..
BOSS
Glad its fixed, I'm not sure how you're accidentally using those characters though. Is your language set to something other than english?
Joshua Weinberg
Hmm, good point, no, I'm using Xcode 3.2.3 on Snow Leopard with English language..
BOSS
Are you copy/pasting code from somewhere?
Joshua Weinberg
Nope, actually, all I did was press the standard dash / minus key on my macbook's keyboard, the one right next to 0.
BOSS
+1  A: 

Make sure that your " characters are straight up and down (and not of the left/right slanted variety).

codemonkey