Loading

sublime下C++开发环境的配置

1-下载与安装

  • 1.下载并安装tdm64-gcc-5.1.0-2(也课根据需要安装其他的编译器,如MingW),保持默认路径不变,其他next即可。

2-计算机环境配置

  • 1.将安装后的bin目录加入到环境变量path中,在cmd中测试命令gcc -v无报错就正常。

3-sublime软件环境配置

  • 1.在ST3的Build system中增加C++编译的配置文件,名称类似C++Complier.sublime-build,前缀可自行命名,
  • 2.配置内容如下重要,注意-fexec-charset=GBK,终端窗口支持中文:
{
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "shell_cmd": "g++ -Wall -std=c++11 -fexec-charset=GBK \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c++,source.c",

    "variants": 
    [
        {   
        "name": "Run",
        "shell_cmd": "g++ -Wall -std=c++11 -fexec-charset=GBK \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""
        }
    ]
}

4-编译&运行

  • 1.最后ctrl+shift+B(或者ctrl+B一次性先编译后运行)即可选择编译或者编译并运行
posted @ 2020-07-19 11:09  Devinwon  阅读(467)  评论(0)    收藏  举报