I try to use Sublime Text in a multi-platform development using gcc. As long as I am on Linux building and running a single C file (what is accessed over sshfs and located on so some Linux machine) is working perfectly. Yet, if I am switching to a Windows PC only the compilation works, and running causes an error. The path of the compiled program to run is composed by Sublime in the following way: “G:\dir\subdir/executable”.
I couldn’t find in the Docs any setting or build configuration what is causing this slash in the path. Windows error message (translated back from German): Can’t find “G:\dir\subdir/executable”, may be misspelled.
Confound slash and backslash on Windows
Does it not working in safe mode assuming you just use the default build system? It just works on my Win10 machine.
Yet, if I am switching to a Windows PC only the compilation works, and running causes an error.
Dumb question: you are pretty sure the executable is generated, right?
Yes, I am sure that the default build system on Windows 10 is producing a working exe. The object produced by gcc (minGW64) can be invoked with cmd or power shell and does it’s job.
The only error is that sublime composes the path of the executable in the wrong way.
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
The default build systems for C/C++ (C++ pictures here, but the C one is identical and uses gcc
and source.c
instead) are where that is coming from; particularly the run
variant , which uses a forward slash when specifying the name of the file to run.
So the question is,when you say that it can be invoked with cmd or power shell, what sort of path are you using? Does it work if you use that which is shown here?
In either case, if that is truly your problem, then creating your own build system as a copy of this one but with that path separator changed should make it work for you.