标签:sublime text3编译运行c++ c++ 配置 编译 运行
1下载MinGW 下载地址: sourceforge.net/projects/mingw/files/ 打开下载的安装程序,按如下方式安装 Install->Change->D:\MinGW->Continue->Continue mingw32-base->mingw32-gcc=g++->Installation->Apply Changes->Apply->Close 2安装好MinGW,我的目录为D:\MinGW,设置环境变量: 变量名 变量值 Path D:\MinGW\bin 3检查MinGW是否安装成功 运行cmd 输入mingw32-make.exe -version显示如下,安装成功 GNU Make 3.82.90 Built for i686-pc-mingw32 Copyright (C) 1988-2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
4新建文件 G++.sublime-build,文件放置到 C:\Users\Administrator\AppData\Roaming\Sublime Text 3\Packages 目录下,文件内容为
{ "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}","-Wall" ], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "selector": "source.c, source.c++", "shell": true, "encoding": "cp936", "variants": [ { "name": "Run", "cmd": [ "g++", "${file}", "-o", "${file_path}/${file_base_name}", "&","start", "C:/cb_console_runner.exe","${file_path}/${file_base_name}"] } ] }其中cb_console_runner.exe放置到C盘根目录下,下载地址为 <a target=_blank href="http://yunpan.cn/cwFpJmWSiGfFY" target="_blank">点击打开链接</a> 访问密码 c0065测试g++
win+R,cmd进入命令提示符,输入 g++ -v,显示如图,表示配置成功
6编写一段C++进行测试
#include<iostream> using namespace std; int main(){ int a,b,c; cin>>a>>b>>c; cout<<"a="<<a<<" b="<<b<<" c="<<c<<" succeed run C++"<<endl; return 0; }Ctrl+B编译,Ctrl+Shift+B运行,如图
恭喜你,从此可以愉快的敲C++代码了!
标签:sublime text3编译运行c++ c++ 配置 编译 运行
原文地址:http://blog.csdn.net/qq_21682823/article/details/46056225