码迷,mamicode.com
首页 > 编程语言 > 详细

Sublime Text3编译运行C++的配置方法2

时间:2015-05-28 09:37:55      阅读:339      评论:0      收藏:0      [点我收藏+]

标签: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>  访问密码 c006
5测试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++的配置方法2

标签:sublime text3编译运行c++   c++   配置   编译   运行   

原文地址:http://blog.csdn.net/qq_21682823/article/details/46056225

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!