Doralitze
Doralitze

Reputation: 192

How to force gcc to ignore localisation

My localisation is set to german and gcc outputs german compiler warnings but codeblocks handles those warnings as errors and doesn't let me run my application. I got so far that I figured out that I need to force gcc to output english warnings but all answers I found were like "set your systems language to english" but I don't want to do so. How can I force gcc to output compiler warnings in english without changing my entire system language?

Upvotes: 2

Views: 1059

Answers (1)

Jonathan Wakely
Jonathan Wakely

Reputation: 171383

GCC uses the LANG, LC_MESSAGES and LC_ALL environment variables.

The most likely cause of GCC printing messags in German is that LANG is set to something like de_DE.UTF-8 so just unset that (or set it to the default POSIX locale, C, or to an English locale such as en_US) before running GCC.

If you can't adjust the command-line that CodeBlocks uses to invoke the compiler then you should be able to adjust the environment before running codeblocks, e.g. instead of running codeblocks to start the IDE (or whatever the command to start the IDE is) run LANG=C codeblocks

That will alter the environment for the codeblocks process and any child processes it runs, including the compiler commands it runs.

If that doesn't work check maybe you have LC_ALL or LC_MESSAGES set in your environment (you can check with echo "LC_ALL is $LC_ALL, LC_MESSAGES is $LC_MESSAGES";) so you can just override that:

LC_ALL=C codeblocks

Upvotes: 2

Related Questions