Sublime Forum

Build and Run C++ source file

#1

Hi.
for example I have this code

[code]#include

using namespace std;

int main() {
int a;
cin >> a;
cout << a << endl;
return 0;
}[/code]

when I press Build I get this message

[Finished in 2.4s]

then I press Run and this message appears and nothing happens after it

[Error 2] The system cannot find the file specified [cmd: [u'bash', u'-c', u"g++ 'C:\\Users\\GAITH\\Desktop\\main.cpp' -o 'C:\\Users\\GAITH\\Desktop/main' && 'C:\\Users\\GAITH\\Desktop/main'"]] [dir: C:\Users\GAITH\Desktop] [path: C:\Program Files\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\IVT Corporation\BlueSoleil\Mobile;C:\Windows\system32\Wbem;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\CodeBlocks\MinGW\bin;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\] [Finished]

what should I do to make my program run?

0 Likes

#2

I tried your code with build 3047 and it works fine.
The only thing is that it seems to ignore the cin. I don’t know if there’s an ‘input’ area in sublime 3 but this type of program should run in a terminal no?

0 Likes