C compile errors: stray '\200' in program and expected ')' before numeric constant

后端 未结 4 2062
一整个雨季
一整个雨季 2021-01-18 07:38

I copied this program and am having trouble with the void downFrequency function (I think). This is for Arduino Uno. Here are the compiler errors: Compiling \'MY_dds\' for

相关标签:
4条回答
  • 2021-01-18 07:58

    Simple copy always mess up the source code.

    One can check the "stray" problem via cat -A yoursrc.c

    To me, I usually reformat the code by vim in two steps.

    vim yoursrc.c
    :%!tr -cd '[:print:]\n'
    

    Then compile gcc yoursrc.c

    0 讨论(0)
  • 2021-01-18 08:01

    You've somehow ended up with "en dash" characters, rather than normal minus signs, in the downFrequency function.

    Make sure you're editing using a text editor, not a word processor; and for each of these:

    toFrequency = (toFrequency – 1);
                               ^
    

    delete the marked character, and retype as a normal minus sign.

    (If you're interested in the gory details, the "dash" character is Unicode 2013, encoded in UTF-8 as three bytes with octal values 324,200,223, which is why you see those numbers in the error messages.)

    0 讨论(0)
  • 2021-01-18 08:01

    The compiler is complaining that there are non-ASCII characters in your source file.

    My octal fu is rusty, but it looks like UTF-8 to me. 342 200 223 is E2 80 93 which is Unicode "EN DASH." This code was given a minus sign makeover by a text editor with a degree in cosmetolegy.

    0 讨论(0)
  • 2021-01-18 08:04

    Probably your double quote symbols (") were wrong. Please check if they are actually ", and not .

    0 讨论(0)
提交回复
热议问题