How to compile codes using Sublime? [duplicate]

-1

I would like to know if I can add a compiler to the sublime to compile things straight from the program, more practical as well.

    
asked by anonymous 17.07.2016 / 18:39

1 answer

1

How do you compile your programs? Do you have any environment variables referencing a binary to run on the command line ? Since Sublime Text 3 has an area called builds , from which you can run commands building section of your application.

I'm not a C ++ developer but I use Sublime builds daily working with Node.js, so I think it's the same process. For now, I'll explain how building works using Node.js simply because it does not have a C ++ environment installed. When you can answer those questions from the beginning, I can then update this answer with the appropriate information.

Step by step

  • Go to Sublime > Tools > Build System > New Build System

I believe Sublime has opened a new file with the .sublime-build extension that should be saved inside ./Packages/User/ . Here are the file settings:

{
  "shell_cmd": "node $file"
}
  

Note that where% is% must be the environment variable of your machine referencing the binary responsible for compiling your scripts C ++ and the parameter node is a reference for the current program that will be compiled.

  • After you save the file to $file . Go to Sublime > Tools > Build System > that was previously saved

When you want to compile your programs, press ./Packages/User/ .

  

IMPORTANT : Sublime does not "kill" the process, even if you press Ctrl + B or Ctrl + C building will continue to run in background . If you want to end the process, go to Sublime > Tools > Cancel Build (a.k.a Esc ).

One more thing ...

I'm currently using Windows so the terminologies I used were based on my OS. If you are using another system I think you will have to search for "interwebs" about how to configure them.

    
17.07.2016 / 23:21