What does: 'error: stray 7 in program' mean?

This is a discussion on What does: 'error: stray 7 in program' mean? within the Linux Programming forums, part of the Platform Specific Boards category; Ok, I am getting the following three errors from my code: Moire.h:1: error: stray 7 in program Moire.h:1: error: stray ...

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

    What does: 'error: stray \357 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
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,160
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,338
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,338
    "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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 12:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21