3

I compiled my porject on a 64-bit linux(2.6.39-gentoo-r3),GCC version 4.6.3 but when I do compiling , the warnings contain some unreadable characters.Just like below:

warning: field precision specifier ?.*?.expects argument of type ?.nt?. but argument 6 has type ?.ong int?.[-Wformat]
warning: format ?.u?.expects argument of type ?.nsigned int?. but argument 7 has type ?.ize_t?.[-Wformat]
warning: ignoring return value of ?.ystem?. declared with attribute warn_unused_result [-Wunused-result]

Although I can guess the messed parts, they looks bad. So does anyone meet the same issue or know how to solve it ?

Hijack
  • 41
  • 3

2 Answers2

1

Usually gcc uses ASCII or UTF-8 encoding for its output. Check your terminal to figure out which encoding it is actually configured for.

As a quick workaround, try running the gcc command in this fashion to see if you can see valid characters (it uses ASCII here):

LC_ALL=C LANG=C gcc ...

If that fixes the problem, your locale is either not configured correctly or at least not the one you'd like to.

To list all the locales supported on your system:

eselect locale list 

Based on this guide, you'd need to set LC_ALL and LANG variables in your .bashrc to configure your locale choosing one from the above list (I'm guessing en_US.UTF-8 in your case).

Tuxdude
  • 47,485
  • 15
  • 109
  • 110
  • I have tried it , it didn't work well. My command is : $ LC_ALL=C LANG=C gcc -c -fPIC -g3 -Wall -Wno-unused -D_DEBUG_LOGGING -D_GNU_SOURCE -I. -Itest test_main.c test_main.c: In function ?.ain?. test_main.c:34:20: warning: initialization makes integer from pointer without a cast test_main.c:51:5: warning: field precision should have type ?.nt?. but argument 2 has type ?.ong unsigned int? test_main.c:51:5: warning: format ?..*s?.expects type ?.har *?. but argument 3 has type ?.nt? – Hijack Mar 01 '13 at 03:03
  • BTW , my local content is :LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE=C LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= – Hijack Mar 01 '13 at 03:06
1

This problem is solved finally. I find it's the issue of my XSHELL By setting XSHELL go UTF8 , it works ok. Thanks to all of you !

Hijack
  • 41
  • 3