温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

sublime text3 中怎么配置c语言环境

发布时间:2021-07-13 11:02:07 来源:亿速云 阅读:139 作者:Leah 栏目:大数据

今天就跟大家聊聊有关sublime text3 中怎么配置c语言环境,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

安装步骤:

sublime text3 中怎么配置c语言环境

sublime text3 中怎么配置c语言环境

完成安装后配置环境变量(重点)

sublime text3 中怎么配置c语言环境

右击··>属性··>高级系统设置··>环境变量··>系统变量

直接新建:变量名:C_INCLUDEDE_PATH  变量值: D:\mingw\mingw64\include                LIBRARY_PATH              D:\mingw\mingw64\libpath里添加:新建:D:\mingw\mingw64\bin    (路径里不能有空格)
gcc -v//检验安装

sublime text3 中怎么配置c语言环境

正常情况是不会出错的,那么开始sublime之旅吧!

在sublime里  tools(工具)··>build system··>new build system 用以下代码覆盖后Ctrl+s

命名  c  保存到默认路径就可以……然后可以将sublime重启一下,build system中 c 选中

开始你的C语言称霸之路···代码出处为 CSDN博客 肥宅_Sean 非常感谢

{     "cmd": ["g++", "${file}", "-std=c++11", "-o", "${file_path}\\\\${file_base_name}", "&", "start", "cmd", "/c", "${file_path}\\\\${file_base_name} & echo. & pause"],    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}",    "selector": "source.c, source.c++", "shell": true,    "encoding":"cp936",
   "variants":    [        {            "name" : "Build Only",            "cmd":["g++", "${file}", "-std=c++11", "-o", "${file_path}\\\\${file_base_name}"]        },        {            "name" : "Run Only",            "cmd" : ["start", "cmd", "/c", "${file_path}\\\\${file_base_name} & echo. & pause"]        },        {            "name" : "Pipe Build and Run",            "cmd":["g++", "${file}", "-std=c++11", "-o", "${file_path}\\\\${file_base_name}","&","${file_path}\\\\${file_base_name}", "<","${file_path}\\\\in",">","${file_path}\\\\out"]        },        {            "name" : "Pipe Run Only",            "cmd" : ["${file_base_name}", "<","in",">","out"]        },        {            "name" : "Project Build & Run",            "cmd" : ["g++", "${file_path}\\\\*.cpp", "-std=c++11", "-o", "${file_path}\\\\project", "&", "start", "cmd", "/c", "${file_path}\\\\project & echo. & pause"]        },        {            "name" : "Project Build Only",            "cmd" : ["g++", "${file_path}\\\\*.cpp", "-std=c++11", "-o", "${file_path}\\\\project"]        },        {            "name" : "Project Run Only",            "cmd" : ["start", "cmd", "/c", "${file_path}\\\\project & echo. & pause"]        }    ]}

随便写个程序测试一下:记得写了以后要Ctrl+s保存了才能Ctrl+b编译哦

(Ctrl+shift+b)选择编译方式(会出现弹框)

第一个 CPP :这个会编译当前文件,并弹出一个cmd命令框(运行这个程序)。

第二个 CPP-Build-Only就是会只编译一下。

第三个CPP-Run-Only就是只运行一下。

第四个CPP-Pipe Build and Run 会在当前代码所在目录找,找到in文件(没有后缀)的内容作为输入,并且,输出给out文件(同样没有后缀)

第五个 Pipe Run Only 跟上面的唯一区别,就是不会编译。就只输出而已。

第六个 Project Build & Run 就是将当前目录下的所有cpp文件,然后集合编译为一个文件,并且,输出为project.exe的文件,且执行该文件。

第七个Project Build Only,只编译,不运行。

第八个Project Run Only,只运行,不编译。

错了以后会提醒你哪里错了的·········友好

#include <stdio.h>void main(){
long  term=0,sum = 0;
int a , i, n;
printf("Input a,n:");
scanf("%d %d", &a, &n);
for (i=1;i<=n;i++)
{
term = term*10+a;
sum = sum + term;
}
printf("sum = %ld\n",sum);
}

安装路上遇到的坑:系统找不到指定文件

No such file or directory

看完上述内容,你们对sublime text3 中怎么配置c语言环境有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注亿速云行业资讯频道,感谢大家的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI