Why does my c++ compiler put trash characters when displaying build messages?

103 Views Asked by At
||=== Build: Debug in prac4e2 (compiler: GNU GCC Compiler) ===|
    C:\Users\...\producto.cpp||In function ‘void CargarProducto(Producto&)’:|
    C:\Users\...\producto.cpp|8|warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long int*’ [-Wformat=]|
    C:\Users\...\producto.cpp||In function ‘void MostrarProducto(Producto)’:|
    C:\Users\...\producto.cpp|28|warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]|
    ||=== Build finished: 0 error(s), 2 warning(s) (0 minute(s), 0 second(s)) ===|
    ||=== Run: Debug in prac4e2 (compiler: GNU GCC Compiler) ===|

For some reason, either the compiler or the program I'm using just want to display these characters instead of regular special characters. It compiles just fine, and I already checked that the compiler was installed correctly twice, but it's just annoying to read and makes it spepcially hard to understand any errors I might have. Maybe I'm missing some kind of language package from windows?

The IDE I'm using is CodeBlocks. Other people on my same uni course don't have this problem, and neither did I before I changed my PC.

1

There are 1 best solutions below

0
anatolyg On

Similar to ubuntuforums.org/showthread.php?t=2311239 using vim, it looks like the Code::Blocks build output window is assuming ANSI character set (extended ASCII) when it is in fact UTF-8. I have no idea whether you can set either Code::Blocks encoding to UTF-8 your your tool-chain's diagnostic log to ASCII/ANSI, but one of those would be the solution I think. Certainly you can set the editor encoding: Settings -> Editor -> General settings -> Font -> Default encoding. That may apply to the diagnostic output too.

– Clifford