I'm using Code::Blocks with Cygwin (GCC 5.4.0).
My code compiles and runs fine until I:
#include <iomanip> (trying to get access to cout << setprecision(int) ).
iomanip generates these errors even without a call to setprecision.
A short sample (it spits out 50 errors, all similar):
/usr/bin/locale:1:1: error: stray '\220' in program
MZ ÿÿ ¸ @ € º ´ Í!¸LÍ!This program cannot be run in DOS mode.
^
/usr/bin/locale:1:1: error: stray '\3' in program
/usr/bin/locale:1:1: error: stray '\4' in program
/usr/bin/locale:1:1: error: stray '\377' in program
/usr/bin/locale:1:1: error: stray '\377' in program
/usr/bin/locale:1:1: error: stray '\270' in program
/usr/bin/locale:1:25: error: stray '@' in program
From the searches I've done, it's obvious that the compiler is unable to interpret some kind of UTF-8 characters. I tracked down that iomanip thinks it's
#include <locale>
from the same directory. But I have retyped the code by hand (it's short) in a new file and replaced it with no change, so I'm at a loss since the error chain always starts at locale line 1 (same numbers on strays) which it reaches from my line 6 #include iomanip -> iomanip line 43 #include locale.
From yet more searches, I went to the trouble of g++ -E
.
Compiling that code works fine, but it's an entirely obnoxious interim step.
I'm also concerned that this error could pop up from including other headers that access a contaminated file, not necessarily just iomanip, so I'd like to be able to track things down with regularity. (Unless someone wants to blame the mirror I used to install Cygwin?)
Note
I'm aware that setprecision() is a convenience, so using other methods will likely be my workaround. My only concern is tracking down the source of the error.
The make command line that I found:
g++.exe -Wall -g -Winit-self -Wredundant-decls -Wfloat-equal -Winline -Wunreachable-code -Wmissing-include-dirs -Wswitch-enum -Wswitch-default -Wzero-as-null-pointer-constant -Wmain -std=c++0x -IC:/cygwin64 -IC:/cygwin64/bin -IC:/cygwin64/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/bits -IC:/cygwin64/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++ -IC:/cygwin64/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/x86_64-pc-cygwin/bits -c "C:/Users/Matthew/Desktop/Example/example iomanip/ex_iomanip.cpp" -o obj/Debug/ex_iomanip.o