So I have this build file
{
"cmd": ["coffee", "-c", "$file"],
"selector": "source.coffee",
"path": "C:\\Users\\Miles\\node_modules\\coffee-script\\bin",
"working_dir": "$project_path"
}
And it keeps on returning the error
[Error 2] The system cannot find the file specified
I have looked for a few days and and all I can find is unix based paths.
I know this is most likely trivial but it has been bugging be for a while
after a lot of tinkering this works fine.
{
"cmd": ["coffee.cmd", "-c", "$file"],
"selector": "source.coffee",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"path": "$HOME/bin:/usr/local/bin:$PATH",
"working_dir": "$project_path"
}
Related
How do I run C++11 in Sublime Text 3?
I found this and this works, but I want it to be able to open cmd each run.
(1)
{
"shell_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",
"shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
Like this one:
(2)
{
"cmd":
[
"g++", "-Wall", "-ansi", "-pedantic-errors", "$file_name", "-o",
"${file_base_name}.exe", "&&", "start",
"cmd", "/k" , "$file_base_name"
],
"selector": "source.cpp",
"working_dir": "${file_path}",
"shell": true
}
The problem with (1) is it runs with the console inside Sublime Text 3, I don't want that, unfortunately.
The problem with (2) is it runs well and it opens CMD each time, which is what I need, but it's on C++98. When I need C++11.
So, is there a way to modify any one of these build systems so that I can run C++11 and make it open CMD every run (instead of running it on the console)? Thanks.
I was able to figure it out with a little bit of tinkering involved.
{
"shell_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",
"shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\" && start cmd /k \"${file_path}/${file_base_name}\""
}
]
}
I am trying to build a custom sublime-build that executes c++ programs in powershell.
I want powershell to exit itself on pressing enter or any other key.
How can this be done ?
This is my sublime-build so far..
{
"cmd": ["g++", "${file}", "-o", "${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"cmd": ["start", "powershell", "-NoExit","& '${file_path}/${file_base_name}.exe'"],
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["start", "powershell", "-NoExit","& ${file_path}/${file_base_name}.exe"],
"shell": true
}
]
}
This is how it looks..
Thanks
Give this a shot.
PSHostRawUserInterface.ReadKey Method
https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.host.pshostrawuserinterface.readkey?view=powershellsdk-7.0.0
{
"cmd": ["g++", "${file}", "-o", "${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"cmd": ["start", "powershell", "-NoExit","& '${file_path}/${file_base_name}.exe';$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');Exit"],
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["start", "powershell", "-NoExit","& ${file_path}/${file_base_name}.exe;$Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');Exit"],
"shell": true
}
]
}
I'm debugging a remote program using gdb on my host computer and gdbserver on my remote.
Everything works fine except that I cannot figure out how to show stdout and stderror on the VS Code terminal.
I have created a launch.json which sets up the debugging environment. The launch json calls a tasks using the preLaunchTask option:
...
"MIMode": "gdb",
"targetArchitecture": "arm64",
"preLaunchTask": "debug_preparation",
"miDebuggerPath": "/usr/bin/gdb-multiarch",
...
The debug_preparation task looks like the following:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "debug_preparation",
"command": "sh",
"args": ["start_debug_session.sh"],
"type": "shell",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "new",
"showReuseMessage": false,
"clear": false,
"close": false
}
}
]
}
Do you have an idea of what is missing?
Maybe, the VS Code terminal is not the right place to do so. If that's the case, I'm happy with any other option.
The only workaround that I have is to start the gdbserver on the remote with the following:
ssh -n -f $USER#$TARGETIP "sh -c 'nohup gdbserver localhost:4444 ${FULL_REMOTE_PATH} > /output/stdout.txt 2>/output/stderr.txt &'"
but it's kind of annoying to always ssh into the remote and open these files to see wath went wrong.
I found a build system for c++ for st3 and it is pretty good but there is a small kink it does not compile unless a .exe file with the source file name exists in the directory. Any idea on how to automate it with the build to create a file if it does not exist or continue?
"windows":
{
"cmd": ["g++", "$file_name","-o", "${file_base_name}.exe", "-lm", "-Wall", "&","start", "${file_base_name}.exe"]
},
"selector": "source.c++",
"shell": true,
"working_dir": "${file_path}"
}
That should run regardless, as the build will create a .exe file with the source name in the current directory. If for some reason it isn't working, remove everything on line 2 after "-Wall" so that it looks like this:
"windows":
{
"cmd": ["g++", "$file_name","-o", "${file_base_name}.exe", "-lm", "-Wall"]
},
"selector": "source.c++",
"shell": true,
"working_dir": "${file_path}"
}
I want to run pascal code in Sublime Text (Sublime Text 2) in OS X Mavericks.
I find this sublime-build that work and run in windows.
(Created by Qwerty. https://stackoverflow.com/users/985454/qwerty)
{
"cmd": ["fpc", "${file_path}/${file_base_name}"],
"selector": "source.pascal",
"variants": [
{
"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
"name": "Run",
"shell": true
}
]
}
but I don`t know how to modify it to work in OS X.
My test is a simple Hello World:
Program HelloWorld;
begin
writeln("Hello, world!");
readln;
end.
Try
{
"cmd": ["fpc", "${file_path}/${file_base_name}"],
"selector": "source.pascal",
"variants": [
{
"cmd": ["open -a Terminal.app '${file_path}/${file_base_name}'"],
"name": "Run",
"shell": true
}
]
}
Also, your "Hello, World!" program should use a single-quoted string:
Program HelloWorld;
begin
writeln('Hello, world!');
readln;
end.