I tried to run executable file from Sublime Text 3 after it was successfully built with C++11 Build System, but got the error:
[WinError 2] The system cannot find the file specified[cmd: ['bash', '-c', "g++ -std=c++0x 'C:\Users\FTP-RSky\Desktop\RSky\rect\test_g++11.cpp' -o 'C:\Users\FTP-RSky\Desktop\RSky\rect/test_g++11' && xterm -e bash -c 'C:\Users\FTP-RSky\Desktop\RSky\rect/test_g++11; read'"]] [dir: C:\Users\FTP-RSky\Desktop\RSky\rect] [path: C:\Program Files\Processing-3.2.1;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files\Java\jdk1.8.0_73\bin\lib;C:\Program Files\Java\jdk1.8.0_73\bin] [Finished]
So I have three build system in Sublime Text 3:
1. C++ Build and Run perfectly fine!!!
2. C++11 Build but not Run. my C++11.sublime-build file:
{
"cmd": ["g++", "-std=c++11", "${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}' -std=c++11 -stdlib=libc++ -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}
3. C++14 Doesn't Build & Run. [WinError 2] The system cannot find the file specified[cmd: my C++14.sublime-build file:
{
"cmd":["bash", "-c", "g++ -std=c++14 -Wall '${file}' -o '${file_path}/${file_base_name}' && '${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++ -std=c++14 '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}
There is a way to build and run modern C++11 & 14 versions inside Sublime Text 3 as a regular C++ output without issues? Or do I miss something?
bash
is not in your path (that's what the error is telling you). The built in build for C++ just invokesg++
directly. You should probably just do it that way, since you know it already works. – OdatNurd