怎样让sublime text3运行c/c++代码
2个回答
2015-01-30
展开全部
我的解决办法:新建一个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"]
}
2015-01-30
展开全部
下载MinGW 下载地址: sourceforge.net/projects/mingw/files/ 打开下载的安装程序,按如下方式安装 `Install`->`Change`->`D:\MinGW`->`Continue`->`Continue` `mingw32-base`->`mingw32-gcc=g++`->`Installation`->`Apply Changes`->`Apply`->
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询