QtCreator: a large number of stray errors

The project worked fine, worked fine, compiled fine. Until some seemingly random time, he ceased to be beautiful.

At the moment, I am fooling 200 unsuccessful errors:

./new:4: error: stray '\376' in program ./new:4: error: stray '\377' in program ./new:5: error: stray '\376' in program ./new:5: error: stray '\377' in program 

From reading other posts, it seems that I have some bad characters in my code that I don't see. So I emptied the whole file I was working on, but no luck. This error persists what I do.

In addition, when compiling main.cpp (which it does first), it primarily includes #include, which is the beginning of the message chain "from" the file. Does this mean that he hasn’t yet understood much of main.cpp, but has received internal Qt files from reading?

I keep looking in the dark, what can it be and how can I solve it?

Thanks!

I am using Qt 4.7.2, GCC 4.5.0 and Win7.

+4
source share
4 answers

Copy the code into notepad and save it. Then delete the main.cpp file and add notepad to your project. Rebuild and verify the result. If it still persists, most likely the problem is not with your source, but with the Qt or gcc and / or gnulibc libraries. They were probably damaged or stored in another unsupported encoding.

+3
source

Octal \376 \377 - 0xFEFF , which is a Unicode Byte-Order Mark . It is used to signal the finiteness of the UTF-16 text file, and also to indicate that the file is encoded in UTF-8 format. This should only happen at the beginning of the file, but it seems to have crept into the header comment in the new library's header file, on lines 4 and 5. Find this file and delete these lines. (But only if they comment!)

+3
source

Things like this happened to me in the past when I copied the source from some web page. Just typing again solved the problem. But perhaps some kind of encoding conversion tool can also fix the problem.

+1
source

Maybe your source file is encoded in UTF-16 or something like that.

Try copying the code into a new file and see if that helps.

0
source

Source: https://habr.com/ru/post/1338417/


All Articles