繁体   English   中英

在Ubuntu的外部终端中使用Sublime Text 2运行一个简单的C程序

[英]Run a simple C program with Sublime Text 2 in external terminal on Ubuntu

在Ubuntu上使用Sublime Text构建和运行C / Cpp的第一步。 我在这里和那里阅读,并通过以下出色的构建构想出了这一点:

{
    "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}; exec bash\"'"]
        }
    ]    
}

是否有更好的方法,尤其是在执行完成后保持终端打开?

任何帮助,将不胜感激。

谢谢,卢卡

它适用于Ubuntu 14.04

{
    "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\"'"]
        }
    ]    
}

尝试从

"cmd": ["gnome-terminal -e 'bash -c \"${file_path}/${file_base_name}; exec bash\"'"]

"cmd": ["gnome-terminal -e 'bash -c \"${file_path}/${file_base_name}; echo 'Press ENTER to continue'; read line; exec bash\"'"]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM