简体   繁体   中英

Sublime Text 3 Build System for Ubuntu

I'm running an Ubuntu 16.04 machine. I want to compile and run C++ programs in Sublime Text 3. A few months ago I came across a build system that compiled and ran the program in terminal in a single command. Due to some reasons I no longer have the build system.

This is what I have in place:

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

It works fine but I have to compile and run the program separately. Is it possible to modify this to achieve what I've mentioned above? Or maybe another build system that could do this?

Not sure if it's irrelevant, I tried using sublime to compile c++ but couldn't. Then tried switching to atom and have been using it since. It can compile code from the editor. You can give it a try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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