1.新建
2.粘贴
MAC
{
"cmd": ["g++", "${file}","-std=c++11", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "g++ '${file}' -std=c++11 -stdlib=libc++ -o '${file_path}/${file_base_name}' && open -a Terminal.app '${file_path}/${file_base_name}'"]
}
]
}
WINDOWS
{
"cmd": ["g++", "${file}","-std=c++11", "-o", "${file_path}/${file_base_name}"],
"file_regex":"^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$",
"working_dir":"${file_path}",
"encoding":"cp936",
"selector":"source.c",
"variants":[
{
"name":"Run",
"cmd":[
"cmd",
"/C",
"start",
"cmd",
"/c",
"${file_path}/${file_base_name}.exe &pause"
]
}
]
}
GCC命令
//编译
gcc temp.cpp -lstdc++ -o temp
//执行
./temp