Ncurses is a library. The most used component is a form. In the operation of Linux system, many friends encounter Chinese garbled problems when using Ncurses. How to deal with this problem? The following small series will introduce you to the Chinese garbled solution when using Ncurses.
There are a few key points:
1.gcc compile-time use, gcc -lncursesw --verbose to see if support -lncursesw connection;
2. Code In the file, set locale
#include
#include
int main(int argc, char const *argv[])
{
setlocale(LC_ALL, “”);
initscr();
noecho();
refresh();
printw (“ I will test Chinese /n”);
getchar();
return 0;
}
3. Command line execution Apt-cache search libncursesw5, check whether the ncurses library is installed
Found that my linux does not support; found under /usr/include/ncurses.h
However, no one else said ncursesw directory ;
Later I found out that I installed libncurses5 and also installed libncursesw5, which caused the -lncursesw option to be unusable. I uninstalled libncurses5 and then reinstalled libncursesw5;
The specific command is
1. apt-cache search libncurses5
2. apt-get purge libncurses5
3. sudo apt-get purge libncurses5-dbg
4. sudo apt -get purge libncurses5-dev
5. sudo apt-get autoremove
6. sudo apt-get clean
7. dpkg -l |
Grep ^rc|
Awk ‘{print $2}’ |
Xargs dpkg -P
Then install libncursesw5, the command is as follows
1. sudo apt-get install libncursesw5
2. sudo apt-get install libncursesw5-dbg
3. sudo apt-get install libncursesw5-dev
Then
gcc -c test.o test.c
gcc -o test test.o -lncursesw
Then run. /test
Found that Chinese can print normally
The above is the introduction of the Chinese garbled solution using Ncurses in Linux. If you have the same problem in the process of using it, If you don't know how to solve it, try the method described in this article.
Linux mail command is often used by system administrators. It is a very practical c
In the CentOS system, most of the command systems have their own, but some commands
Linux multi-path refers to the connection between the host and the hard disk, and also includes the
When you are working on a Linux system, you sometimes encounter problems with files
Linux system iPtraf installation and use method
What is the command to specify the line in the Linux view file?
How to view Linux mounted disk
Linux routing command operation example summary
What can I do if Sublime Text cannot be imported into Chinese in Linux?
Git Workflow and Basic Operations in Linux
How to use Linux to periodically delete expired files using the command
Win2000 domain controller diagnostics
How to replace the classic theme of win7 system?
Windows 7 settings allow programs or functions to pass the firewall method
Win7 system can not open the Office2010 file two solutions
Unveiled the mystery of Office 2013
Asp.net4.0 website (windows2003 enterprise version) on iis6.0
Upgrade update win10 encountered two solutions for error code 8024000B