SublimeText C++ 在 Build 上阻止 运行
SublimeText C++ prevent Run on Build
我在 macOS 上使用 SublimeText-3 进行 C++ 编程,尝试利用构建功能。
在这种情况下,我希望(仅)通过执行 Cmd+B 来构建我的程序。而 Cmd+Shift+B 将 运行 它。
但是当我按下 Cmd+B 时,构建和 运行。
以下是C++ Single File.sublime-build
的内容:
{
"shell_cmd": "g++ \"${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++14 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
里面有什么奇怪的吗?
如何拆分构建和 运行 不同的命令?
一些参考:Sublime text 3 - compile program and run in terminal
在首选项 - 键绑定中我看到:
{ "keys": ["f7"], "command": "build" },
{ "keys": ["super+b"], "command": "build" },
{ "keys": ["super+shift+b"], "command": "build", "args": {"select": true} },
我觉得还行
你检查过你的按键绑定了吗?他们可能以某种方式被分配给同一个键。在 首选项 - 键绑定 中,您应该会看到您的设置。我不是 mac 用户,但您的 C++ 构建文件看起来不错。键绑定中的构建设置应如下所示:
{ "keys": ["ctrl+b"], "command": "build" },
{ "keys": ["ctrl+shift+b"], "command": "build", "args": {"select": true} }
不要忘记将 ctrl 更改为您在 macs 上的任何内容。
我在 macOS 上使用 SublimeText-3 进行 C++ 编程,尝试利用构建功能。
在这种情况下,我希望(仅)通过执行 Cmd+B 来构建我的程序。而 Cmd+Shift+B 将 运行 它。
但是当我按下 Cmd+B 时,构建和 运行。
以下是C++ Single File.sublime-build
的内容:
{
"shell_cmd": "g++ \"${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++14 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
里面有什么奇怪的吗?
如何拆分构建和 运行 不同的命令?
一些参考:Sublime text 3 - compile program and run in terminal
在首选项 - 键绑定中我看到:
{ "keys": ["f7"], "command": "build" },
{ "keys": ["super+b"], "command": "build" },
{ "keys": ["super+shift+b"], "command": "build", "args": {"select": true} },
我觉得还行
你检查过你的按键绑定了吗?他们可能以某种方式被分配给同一个键。在 首选项 - 键绑定 中,您应该会看到您的设置。我不是 mac 用户,但您的 C++ 构建文件看起来不错。键绑定中的构建设置应如下所示:
{ "keys": ["ctrl+b"], "command": "build" },
{ "keys": ["ctrl+shift+b"], "command": "build", "args": {"select": true} }
不要忘记将 ctrl 更改为您在 macs 上的任何内容。