Sublime Forum

Compiling using MinGW

#1

So i’ve scoured the forums to no avail.

My PATH is set to the bin folder in MinGW, my c++ build system in ST2 is as follows:

{ "cmd" : "g++", "$file_name", "-o", "${file_base_name}.exe", "&&", "${file_base_name}.exe"], "selector" : "source.c", "shell":true, "working_dir" : "$file_path" }

I want to compile the most basic of cpp files:

[code]#include

using namespace std;

int main(void)
{
cout << “Hello World” << endl;
return 0;
}[/code]

I’m using Windows 7 64 bit with the ST2 (non-beta) 64bit.
How do I use a build system to compile and then run this Hello World program.

0 Likes

#2

With the default sublime c++ build script :

{
	"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}'"]
		}
	]
}

I just hit build (ctrl+B) & then run (shift+ctrl+B) and it works. What are you trying to achieve exactly ? And what is not working for your ?

0 Likes