Sublime Forum

Can't run C++ code on Windows XP

#1

Hi,

I’ve installed MinGW and trying to run (Ctrl+Shift+B) very simple “hello world” C++ program (btw, build finished OK) on Windows XP (on Ubuntu it runs ok) with default build system (Tools->Build System->Automatic), but it fails with error:

[Error 2] 
[cmd:  [u'bash', u'-c', u"g++ 'D:\\Dropbox\\SublimeText2\\TestCpp\\Test.c' -o 'D:\\Dropbox\\SublimeText2\\TestCpp/Test' && 'D:\\Dropbox\\SublimeText2\\TestCpp/Test'"]]
[dir:  D:\Dropbox\SublimeText2\TestCpp]
[path: ...(I've deleted unrelated paths)...;C:\MinGW\bin]
[Finished]

There is a test program:

#include <stdio.h>
#include <iostream>
#include <fstream>

#define SUBLIME

#if defined SUBLIME
	#define ISTREAM ifile
#else
	#define ISTREAM std::cin
#endif

int main (int argc, char* argv]) 
{
	int a, b, c;
	std::cout << "Enter: ";
	#if defined (SUBLIME)
		std::ifstream ifile("stdin.input");
	#endif
	ISTREAM >> a >> b;
	c = a + b;
	std::cout << a << '+' << b << '=' << c << std::endl;
	
	return 0;
}

Is there any way to run C++ code in SublimeText2 console on WinXP?

0 Likes