p2or
1/5/2012 - 4:53 PM

Getting Sublime Text to build a C++ file.

Getting Sublime Text to build a C++ file.

C++ Sublime Text Build

This builds single C++ files in Sublime Text, handy for testing small things.

Works With

  • OSX (Assuming xcode installed)
  • Linux (Should work if g++ is installed)
  • Windows (Need CL working)

Thanks to adnansky for Linux Test and Shell update.

{
	"cmd": ["g++ -Wall ${file} -o ${file_base_name} && ./${file_base_name}"], "working_dir": "${file_path}",
	"selector": "source.c++",
	"shell": true,

	"windows":
	{
		"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"],
		"selector": "source.c++",
		"shell": true
	}
}

{
	"cmd": ["g++", "$file", "-o", "$file_base_name", "-I/usr/local/include"],
	"selector": "source.c++",

	"windows":
	{
		"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"]
	}
}