Sublime Forum

New-user-[WinError 2] The system cannot find the file specified for c++

#1

this is my build below:

{
“cmd”: [“g++.exe”,"-std=c++14", “${file}”, “-o”, “${file_base_name}.exe”, “&&” , “${file_base_name}.exe<inputf.in>outputf.in”],
“selector”:“source.cpp”,
“shell”:true,
“working_dir”:"$file_path"
}

i ran in cmd it worked fine.

error:
[WinError 2] The system cannot find the file specified
[shell_cmd: g++ “C:\Users\Mithilesh Yadav\Documents\hlo.cpp” -o “C:\Users\Mithilesh Yadav\Documents/hlo.exe” && “C:\Users\Mithilesh Yadav\Documents/hlo.exe”]
[dir: C:\Users\Mithilesh Yadav\Documents]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\MinGW\bin;C:\Program Files\Sublime Text\Lib;C:\Users\Mithilesh Yadav\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Mithilesh Yadav\AppData\Roaming\npm;C:\MinGW\bin]
[Finished]

i have set already the path.
i don’t know what to do now i tried to run the same program in VS code as well it works fine.
i don’t know what is wrong with sublime every month or with every update an error message pops out. I feel like i really should leave using sublime.

0 Likes

#2

Looks like you haven’t selected the custom build system you’ve written. The command ST is running doesn’t match what you’ve pasted. You can select the build system under Tools > Build System > …. Additionally it could be that you haven’t installed gcc in mingw environment.

1 Like

#3

Yes, but even after selecting the custom build, the problem remains same.

0 Likes

#4

“Additionally it could be that you haven’t installed gcc in mingw environment”.

but how to do that…

in cmd it works fine…


0 Likes

#5

From the look of things you’re trying to run a shell command in the build system, but you’re using "cmd". You should be using "shell_cmd": "g++.exe -std=c++14 ${file} -o ${file_base_name}.exe && ${file_base_name}.exe < inputf.in > outputf.in"

0 Likes

#6

thanks… @bschaaf
the problem is resolved…
I tried all the solutions on the forum and on stackOverflow but nothing worked at all and at the end i updated my windows 10 software all the things related with environment variable got resolved.
In my case this worked which was totally unexpected to me.

0 Likes