展开全部
我的解决办法:新建一个build systems
//my_cpp
{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "&", "${file_path}/${file_base_name}.exe"]
}
]
}
但是只能通过点手动run,快捷键ctrl shift B不起作用
这样就解决了:
//my_cpp
{
//"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "&", "${file_path}/${file_base_name}.exe"]
}
这是我试出来更好的
//C++_My
{
//"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"cmd": [ "g++", "${file}", "-o", "${file_path}/${file_base_name}", "&","start", "${file_path}/${file_base_name}.exe"]
}
//my_cpp
{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"variants":
[
{
"name": "Run",
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "&", "${file_path}/${file_base_name}.exe"]
}
]
}
但是只能通过点手动run,快捷键ctrl shift B不起作用
这样就解决了:
//my_cpp
{
//"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}", "&", "${file_path}/${file_base_name}.exe"]
}
这是我试出来更好的
//C++_My
{
//"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"cmd": [ "g++", "${file}", "-o", "${file_path}/${file_base_name}", "&","start", "${file_path}/${file_base_name}.exe"]
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询