Sublime Forum

[WinError 2] The system cannot find the file specified for C++

#1

Hello everyone,
I am facing issues to build my C++ programs. The error is something like this.

[WinError 2] The system cannot find the file specified
[cmd: [‘g++.exe’, ‘-std=c++14’, ‘C:\Users\Dell\Desktop\test.cpp’, ‘-o’, ‘test.exe’, ‘&&’, ‘test.exe<inputf.in>outputf.in’]]
[dir: C:\Users\Dell\Desktop]
[path: C:\Program Files (x86)\Intel\Intel® Management Engine Components\iCLS;C:\Program Files\Intel\Intel® Management Engine Components\iCLS;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Intel\Intel® Management Engine Components\DAL;C:\Program Files\Intel\Intel® Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel® Management Engine Components\IPT;C:\Program Files\Intel\Intel® Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\Dev-Cpp\mingw32\bin;C:\Program Files\Git\cmd;C:\MinGW\bin;C:\Users\Dell\AppData\Local\Programs\Python\Python38\Scripts;C:\Users\Dell\AppData\Local\Programs\Python\Python38;C:\Users\Dell\AppData\Local\atom\bin;C:\Users\Dell\AppData\Local\Programs\Microsoft VS Code\bin;C:\MinGW\bin;C:\Users\Dell\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\System Tools;]
[Finished]

My C++ build system is
{
“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’ve already added MinGW\bin to the Path.
Someone Please help me. I’m trying to solve it since couple of days.

0 Likes

#2

Are you able to run that command from the command line?

0 Likes

#3

I’m guessing ${file_base_name}.exe<inputf.in>outputf.in doesn’t exist.

1 Like

#4

Thanks for replying sir

Yes I can run that program using powershell

0 Likes

#5

Thank you everyone for replying, but I resolved the error
Actually, I found that my command prompt was also not starting. So, I searched for cmd.exe in my C>windows>system32 but did not find it there. Instead I found it at C>windows>SysWOW64 .
So I pasted the same in system32 and command prompt started working. This also resolved my issue with Sublime Text

0 Likes

#6

i am also getting the same error here. Even my cmd is also working fine.

[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]

build: {
“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 have already set the environment variable.
I had change my hard disk few weeks ago and now tried to setup sublime and encountered this really annoying error please help.

0 Likes

#7

I’m also getting an error like this:

[WinError 2] The system cannot find the file specified
[cmd: [‘bash’, ‘-c’, “g++ -std=c++14 ‘C:\Users\DELL\Desktop\code\Anton and Danik.cpp’ -o ‘C:\Users\DELL\Desktop\code/Anton and Danik’ && ‘C:\Users\DELL\Desktop\code/Anton and Danik’”]]
[dir: C:\Users\DELL\Desktop\code]
[path: C:\Program Files\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files\Java\jdk-21\bin;C:\Program Files\nodejs;C:\Program Files\nodejs;C:\Users\DELL\AppData\Roaming\npm;C:\Program Files\Git\cmd;C:\Users\DELL\AppData\Local\Programs\Python\Python311\Scripts;C:\Users\DELL\AppData\Local\Programs\Python\Python311;C:\Users\DELL\AppData\Local\Microsoft\WindowsApps;C:\Users\DELL\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\DELL\AppData\Local\Programs\Python\Python311;C:\Users\DELL\AppData\Local\GitHubDesktop\bin;C:\MinGW\bin]
[Finished]

Can anyone help me to resolve this error.

0 Likes