Code :: Blocks - error: stray '\ 240' [closed]

0

I am facing a simple problem, I believe. I save my file in .cpp in Code :: Blocks and then try to compile it. However, when compiling, some errors appear (Usage compiler minGW):

Compilersettings:

UseWindows8.1.Doesanyoneknowhowtosolveit?Simplecodethatpresentserrors:

#include <iostream>using namespace std;int main (){cout << "Hello World!"; return 0;
}
    
asked by anonymous 05.10.2016 / 17:59

2 answers

1

Like mentioned by Joseph , somewhere in your code there are unexpected characters, assuming you are using Unicode or ISO-8859-1, 0 may represent the character non-breaking space (blank space that does not allow line wrapping).

This can happen when you copy the code from some website, perhaps because it contains unreadable characters (which you can not see), another cause might be the encoding you are using, you can check in SettingsEditorOther SettingsEncoding .

Create a new project and try using the code below.

#include <iostream>

using namespace std;

int main() {
    cout << "Hello World!";
    return 0;
}
    
05.10.2016 / 19:22
1

Error typing: It has an invalid character somewhere in its source, probably an "á".

\ 240 = 128 + 32 = 160 (Alt + 160 on Windows is "á")

    
05.10.2016 / 18:06