Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange gcc error: stray '\NNN' in program

The following issue popped up in my open source library, and I can't figure out what's going on.

Two of my users have (gcc) compiler errors that look like:

/home/someone/Source/src/._regex.cpp:1:1: warning: null character(s) ignored
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\5’ in program
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\26’ in program
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\7’ in program
/home/someone/Source/src/._regex.cpp:1:5: warning: null character(s) ignored
/home/someone/Source/src/._regex.cpp:1: error: stray ‘\2’ in program
...

I can't reproduce these errors; the code compiles fine on all machines I've tested.

Googling around seemed to indicate that this is often a result of a strange encoding or strange formatting, but I ran all the source through a hex editor, and all characters are either printable ASCII (0x20 - 0x7E), or tab, or newline. That's it.

Also, both users successfully compiled the previous version of the library; but the particular file in question (regex.cpp) and its header files haven't been modified since that time!

Please see here for more details, including links to download the code if you want. But I'd be happy with just a pointer in a possible direction.

like image 892
Jesse Beder Avatar asked Oct 25 '09 16:10

Jesse Beder


1 Answers

The errors are in ._regex.cpp, not regex.cpp.

Files starting with ._ are autogenerated by Mac OS X. It seems your build system tries to compile all files ending with .cpp. It probably shouldn't compile anything starting with a dot.

like image 169
Baffe Boyois Avatar answered Oct 08 '22 17:10

Baffe Boyois