linux下解决Sublime Text3编译C++输入问题

看了太多版本,到最后不能解决输入问题,网上很多版本都是在Windows下调用CMD的,在linux不能使用

经过半天的百度,还是决定去Google,成功找到大神解答。

网上给出的能解决输入问题的有这个方案:


  "cmd": ["g++", "$file", "-o", "${file_path}/${file_base_name}"],
  "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
  "working_dir": "${file_path}",
  "selector": "source.c, source.c++, source.cxx, source.cpp",
  "variants":
  [
      {
          "name": "Run",
          "shell": true,
          "cmd": ["gnome-terminal -e 'bash -c \"${file_path}/${file_base_name};echo;echo;  echo Press ENTER to continue; read line;exit; exec bash\"'"]
      }
  ]    
}

但是我首先碰到了问题:

gnome-terminal没有安装,于是安装:

sudo apt-get remove gnome-terminal && sudo apt-get install gnome-terminal

随后出现问题:

(gnome-terminal:22242): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

看网上大神说的意思是:

“由于我们安装的支持中文的库使用的是GTK2.0的图形库,而gnome-terminal使用的是GTK3.0的库”


于是Google得到答案,亲测可用:

{
  "cmd": ["g++", "$file", "-o", "${file_path}/${file_base_name}"],
  "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
  "working_dir": "${file_path}",
  "selector": "source.c, source.c++, source.cxx, source.cpp",
  "variants":
    [
        {
           "name": "Run",
            //use this if you want to input other command after programm execution
           // "shell_cmd": "xterm -e '${file_path}/${file_base_name}; bash'",
           //or you can use the below setting if you just want to execute this program
           "shell_cmd": "xterm -hold -e ${file_path}/${file_base_name}",

        }
    ] 
}

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值