linux shell中文乱码问题

本文详细介绍了在Linux Shell环境中遇到的中文乱码问题,并提供了一种有效的解决方案。通过设置正确的语言环境变量,可以避免编译过程中出现的中文乱码错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow

               

          linux shell中文乱码问题经常碰到, 以前也碰到过, 就听之任之了。 实际上, 有很多方法可以解决这个显示问题, 下面我来提供一种, 聊作记录:

taoge@localhost test> lstest.cpptaoge@localhost test> g++ test.cpp test.cpp: In function 鈥榠nt main()鈥                                      test.cpp:10: error: invalid conversion from 鈥榠nt鈥to 鈥榗onst char*鈥test.cpp:10: error:   initializing argument 1 of 鈥榮td::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]鈥test.cpp:11: error: invalid conversion from 鈥榠nt鈥to 鈥榗onst char*鈥test.cpp:11: error:   initializing argument 1 of 鈥榮td::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]鈥test.cpp:12: error: invalid conversion from 鈥榠nt鈥to 鈥榗onst char*鈥test.cpp:12: error:   initializing argument 1 of 鈥榮td::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]鈥taoge@localhost test> taoge@localhost test> taoge@localhost test> taoge@localhost test> LANG="zh_CN.GB18030" taoge@localhost test> taoge@localhost test> taoge@localhost test> taoge@localhost test> g++ test.cpp test.cpp: In function ‘int main()’:test.cpp:10: 错误:从类型‘int’到类型‘const char*’的转换无效test.cpp:10: 错误:  初始化‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’的实参 1test.cpp:11: 错误:从类型‘int’到类型‘const char*’的转换无效test.cpp:11: 错误:  初始化‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’的实参 1test.cpp:12: 错误:从类型‘int’到类型‘const char*’的转换无效test.cpp:12: 错误:  初始化‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’的实参 1taoge@localhost test>

       要想使得修改永久剩下, 那就用export放到~/.bashrc中, 然后source ~/.bashrc一下吧。

       本文聊作记录。






           

分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.youkuaiyun.com/jiangjunshow

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值