{
"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",
"working_dir": "${file_path}",
"cmd": ["${file_path}/${file_base_name} < ${file_path}/${file_base_name}.input"]
}
]
}
这是我创建的sublime-text 2自定义构建文件,用于编译代码并使用输入文件运行代码。但是,它总是返回以下错误。
[Errno 2] No such file or directory
[cmd: [u'/home/p-kar/codebase/codechef/CDR2014/test < /home/p-kar/codebase/codechef/CDR2014/test.input']]
[dir: /home/p-kar/codebase/codechef/CDR2014]
[path: /home/p-kar/bin:/usr/local/bin:/home/p-kar/bin:/usr/local/bin:/home/p-kar/bin:/usr/local/bin:/home/p-kar/bin:/usr/local/bin:/home/p-kar/bin:/usr/local/bin:/home/p-kar/bin:/usr/local/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/p-kar/bin]
[Finished]
我哪里错了?
答案 0 :(得分:0)
在您的示例中,您的run
变体在运行之前不会编译任何内容。您需要将构建文件编辑为:
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "/usr/local/bin/gcc '${file}' -Wall -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}