Sublime Forum

Build System Problem

#1

I used to use codeblocks for running C++ in windows.Now i use sublime text on ubuntu 20.04. My build system in ubuntu is as follows :

 {
  /* Custom Build file for C++14, supports input from user.
  * Default terminal emulator is gnome-terminal. You can change it to xterm or
  * terminator by changing "gnome-terminal -x" in "cmd" in "variants" field to
  * "xterm -e" or "terminator -x".
  */

  "cmd": ["g++", "-std=c++14", "$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",
      "cmd": ["bash", "-c", "g++ -std=c++14 '${file}' -o '${file_path}/${file_base_name}' && gnome-terminal  -- bash -c '\"${file_path}/${file_base_name}\" ; read'"]
     }
   ]
 }

The problem is : In codeblocks I used to get a message like process returned 0 and execution time xyz second just like the picture.

But in sublime text i get nothing.What to do so that i get execution time or anything after running the program ?
Currently my terminal looks like the following picture after building and running from ubuntu.


Thanks for your time.

0 Likes

#2

In Sublime, build systems are for executing external programs, and unless you tell it otherwise it will tell you the amount of time the program was running and (if it failed) what the returned error status was.

Your build is telling it to open an external terminal and have that terminal run something. So, in Sublime in the build panel you would get to see the results of that.

The image you’re posting is of output in the terminal where your program is running. That’s entirely out of Sublime’s purview; if you want the terminal to display that kind of information, you need to configure your terminal (here gnome-terminal to display that, or use a different one instead that displays this).

0 Likes

#4

Thanks for your reply.
How to tell it to show that the amount of time it takes and the returned status or just a simple message like "click any key to continue " ?

0 Likes

#5

What you want to do is, directly in your terminal, figure out the command that you want to execute that does what you want, and once you have that you can tell Sublime.

Under linux, the time command can be used to count the amount of time used by a process when it executes, and read -p 'message here' will wait for you to press enter before continuing.

0 Likes

#6

Thank you so much. Everything is now fixed

0 Likes