Using Windows Subsystem for Linux (WSL) from Sublime Text

I wanted to use gcc, g++and makefor Sublime, to be able to compile c and C ++ codes for Linux executables on Winows. I could not start bash.exefrom Sublime, like many other users in stackoverflow.

+4
source share
1 answer
  • You need to copy the file C:\Windows\System32\bash.exeto a directory C:\Windows\SysWOW64\. Required due to the redirection of the WoW64 file system (Thanks Martin !)

  • Then you need to create a new build system in Sublime Text with the following code. ( Tools -> Build System -> New Build System...)

    {
      "cmd" : ["bash", "-c", "gcc ${file_name} -o ${file_base_name} && ./${file_base_name}"],
      "shell": true,
      "working_dir": "${file_path}",
    }

    This code will compile the .c code and run it. The output will be shown in the Sublime Build Results panel.

  • If you want to use this build system, select it in the list Tools -> Build System, and then click Ctrl + B.

You can charge the command that I put, the main thing is that you can run linux commands with bash -c "CommandsYouWantToRun"

+4
source

Source: https://habr.com/ru/post/1660021/


All Articles