AndreiL
Welcome to AndreiL.
Enjoy your time.
Please log in.

Join the forum, it's quick and easy

AndreiL
Welcome to AndreiL.
Enjoy your time.
Please log in.
AndreiL
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Sublime Text 2 C++ Build+Run Windows settings

Go down

Sublime Text 2 C++ Build+Run Windows settings Empty Sublime Text 2 C++ Build+Run Windows settings

Post by Lucaci Andrei Tue Oct 16, 2012 8:16 am

The default folder of the packages for the C++ build under Sublime Text2 using MinGW located in a different folder than the usual C:\MinGW (but I guess it will work for the default as well).
Code:
C:\Users\~Your_User_Name~\AppData\Roaming\Sublime Text 2\Packages\C++
In there search for a file
Code:
C++.sublime-build
Open it with Notepad/Notepad++/Sublime Text and it should look like this:
Code:

{
   "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
   "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
   "working_dir": "${file_path}",
   "selector": "source.c, source.c++",
   "variants":
   [
      {
         "name": "Run",
         "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"],
         "cmd": "${file_path}\\\\${file_base_name}.exe"
      }
   ]
}
In order to do add that run onto your build you'll need another command inserted there:
Code:
"cmd": "${file_path}\\\\${file_base_name}.exe"
So your complete settings will be:
Code:

{
   "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
   "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
   "working_dir": "${file_path}",
   //"cmd": "${file_path}\\\\${file_base_name}.exe",
   "selector": "source.c, source.c++",

   "variants":
   [
      {
         "name": "Run",
         "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"],
         "cmd": "${file_path}\\\\${file_base_name}.exe"
      }
   ]
}
In the original folder comment all the lines by adding /*in from of everything, on the first row, and */ on the last row. After that copy the code posted above, save the file, than try a simple build on your Sublime Text.
Lucaci Andrei
Lucaci Andrei
"Tata Lor"
Sublime Text 2 C++ Build+Run Windows settings 138

Number of messages : 222
Points : 2266743
Reputation : 1007
Registration date : 2008-08-15
Age : 28
Location : Cluj-Napoca

http://www.andreil.wgz.ro

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum