Warning message of g++ in MinGW

References

[1] http://stackoverflow.com/questions/10191063/mingw-g-gives-warnings-in-wrong-language-german-instead-of-english

[2] localization - Non-localized version of MinGW- - Stack Overflow


Introduction

In MinGW, although localization on the g++ compiler makes the warning and error message "user-friendly", it can be troublesome. It was found that the Eclipse CDT message parser can only identify the English word "warning" as warning, while the "warning" in other languages (such as 警告) are regarded as error message. Therefore, every time you want to compile the code in Eclipse, you receive the error message dialog, which is annoying. To solve this problem, you may ask the Eclipse team to make the parser be able to recognize different languages. However, the faster way is to solve this problem is to add an environment variable in your Windows system.

Syndrome

C:\Users\_____\src>g++ -O0 -g3 -fsyntax-only -Wall -c
-fmessage-length=0 -o "src\\GrammarBook.o" "..\\src\\GrammarBook.cpp"
..\\src\\GrammarBook.cpp: In member function 「void GrammarBook::LoadContentToGrammar(Grammar&, char*)」:
..\\src\\GrammarBook.cpp:163:16: 警告:未使用的變數 「newG」

Solution[1]

Control Panel -> System -> Advanced System Settings -> Environment Variables... -> System variables -> New.. -> Variable: LC_ALL, Value: en_US.UTF-8

If you are successful, the message becomes

C:\Users\_____\src>g++ -O0 -g3 -fsyntax-only -Wall -c
-fmessage-length=0 -o "src\\GrammarBook.o" "..\\src\\GrammarBook.cpp"
..\\src\\GrammarBook.cpp: In member function 'void GrammarBook::LoadContentToGrammar(Grammar&, char*)':
..\\src\\GrammarBook.cpp:163:16: warning: unused variable 'newG'

本篇發表於 C++ 並標籤為 , , 。將永久鏈結加入書籤。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *