Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QtCreator: a big lot of stray errors

Tags:

gcc

qt

qt-creator

Project was doing fine, running fine, compiling fine. Until some seemingly random time it stopped being fine.

At the moment I'm getting around 200 stray 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 I have some bad characters in my code which I cannot see. So I emptied the whole file I was working on, but no luck. This error persists whatever I do.

Also, when compiling main.cpp (which it does first), it first and foremost includes #include , which is the start of the chain of "from 'file'" messages. This means it didn't really parsed much of main.cpp yet but gets borked from reading internal Qt files?

I'm totally gazing in the dark here, what could this possible be, and how would I resolve this?

Thank you!

I'm using Qt 4.7.2, GCC 4.5.0 and Win7.

like image 496
Taco de Wolff Avatar asked Feb 04 '11 11:02

Taco de Wolff


4 Answers

Copy your code into notepad and save it. Then remove your main.cpp and add the notepad one to your project. Rebuild and check the result. If it still persists then most probably the problem is not with your source but with the Qt or gcc and/or gnulibc libraries. They probably got corrupted or are stored in a different, unsupported encoding.

like image 56
Shinnok Avatar answered Nov 11 '22 20:11

Shinnok


Octal \376 \377 is 0xFEFF, which is the Unicode Byte-Order Mark. It is used to signal the endianness of a UTF-16 text file, and also to signal that a file is UTF-8-encoded. It should only occur at the start of a file, but it seems to have crept into the header comments in your library header file new, at lines 4 and 5. Locate this file, and delete those lines. (But only if they're comments!)

like image 21
TonyK Avatar answered Nov 11 '22 20:11

TonyK


Your source file is probably encoded in UTF-16 or something like that.

Try copy-pasting the code in a new file and see if that helps.

like image 1
the JinX Avatar answered Nov 11 '22 19:11

the JinX


to me things like these happend in the past when I copied source from some web page. Only typing it again solved the issue. But maybe some tool to convert the encoding might fix the issue as well.

like image 1
AndyAndroid Avatar answered Nov 11 '22 19:11

AndyAndroid