Thread: What does: 'error: stray ‘o357’ in program' mean?

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    33

    What does: 'error: stray ‘o357’ in program' mean?

    Ok, I am getting the following three errors from my code:

    Moire.h:1: error: stray ‘\357’ in program
    Moire.h:1: error: stray ‘\273’ in program
    Moire.h:1: error: stray ‘\277’ in program

    All which occur on line 1 of my code, which is just a comment. I have no idea what these errors actually mean. Anyone have any ideas?

    Thanks.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The \357 means that the character there is numer 357 in octal (base 8). On my windows system, all three of your characters look like garbage, so I don't really know what is going on.

    Is this a Windows or Linux file? What editor did you use to create it?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Phanixis View Post
    Ok, I am getting the following three errors from my code:

    Moire.h:1: error: stray ‘\357’ in program
    Moire.h:1: error: stray ‘\273’ in program
    Moire.h:1: error: stray ‘\277’ in program

    All which occur on line 1 of my code, which is just a comment. I have no idea what these errors actually mean. Anyone have any ideas?

    Thanks.
    It means you have some goofy characters on that line. They are probably invisible. Try deleting the line entirely and retyping it.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    The numbers are octal, so convert them to say hex and then look them up in a charmap.

    Most likely is that someone has tried to use say (c) as an actual symbol rather than writing out 3 characters.

    The easy answer is just edit out the offending characters.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    It's a UTF-8 byte order mark.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, that means that the text was created in something like Notepad, right?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Oct 2007
    Posts
    33
    This is all in linux, and I am editing the text through nano.

    Fortunately, the first line of code is just a comment. So I took brewbuck's advice and deleted the comment, which got rid of the problem.

    Thanks for all the help.

  8. #8
    Registered User
    Join Date
    Dec 2010
    Posts
    1

    Change ANSI from UTF8

    Dear my friend the reason of the problem is related to utf8. So you need to convert your .cpp file into ANSI. To do so, firstly right click your .cpp file and open with notepad. Then, file->save as and see Encoding label and change ANSI from UTF8. and save. That's all. )

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    "Dear friend" left 3 years ago - read the forum rules on digging up the bone yard with "me too" posts.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please Help [Error] stray backslash in program
    By Tatsuo Go in forum C Programming
    Replies: 1
    Last Post: 09-19-2017, 09:07 PM
  2. error stray 240 in program
    By sean146 in forum C Programming
    Replies: 3
    Last Post: 11-19-2016, 07:14 PM
  3. Replies: 2
    Last Post: 12-07-2009, 10:26 PM
  4. C compiling / error: stray ‘\’ in program
    By Elya in forum C Programming
    Replies: 5
    Last Post: 07-02-2009, 08:20 AM
  5. Error: invalid use of member (did you forget the ‘&’ ?)
    By blacknail in forum C++ Programming
    Replies: 6
    Last Post: 11-06-2008, 12:01 PM