对C语言编程的崇高文本2构建系统 [英] sublime text 2 build system for C programming language

查看:160
本文介绍了对C语言编程的崇高文本2构建系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在学C语言。我指由丹尼斯里奇&放书; Kernighan的。还有前刚刚ANSI投诉程序。我已经安装了ANSI编译器。我刚安装了崇高的文本2编辑器。可能有人给我一个构建系统,将执行以下操作。

I'm learning C language. I'm referring book by Dennis Ritchie & Kernighan. And there fore Just ANSI complaint programs. I've installed ANSI compiler. I just installed Sublime text 2 editor. Could someone give me a build system that would do the following.

1)我的编译源文件

2)显示错误(格式正确的方式)中崇高的不成功的编译。

2) Display error (in well formatted manner) within sublime on unsuccessful compilation.

3)在成功编译,生成具有相同的名称作为我的工作目录中的源文件名的二进制文件。

3) On successful compilation, Generate binary file with name same as the Source file name within my working directory.

4)接受崇高内任何用户输入来计算输出。 (因为我是一个初学者我大多写会要求用户输入前程序:。程序来计算用户的输入名称的字符数)

4) Accept Any user input within sublime to calculate Output. (Since i'm a beginner i mostly write programs that would ask the user to input. ex: Program to calculate number of characters in user input name.)

5)编译和放大器单独的选择;运行。

5) Separate selection for Compile & run.

先谢谢了。

推荐答案

从菜单中,选择Build - >新建构建系统...
和复制粘贴此:

From menu, choose Build -> New build system ... and copy-paste this:

的Windows

只编译:

{
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}.exe", "-lm", "-Wall"],
"selector" : "source.c",
"shell":true,
"working_dir" : "$file_path"
}

编译和放大器;运行:

{
    "windows":
    {
        "cmd": ["cc","-std=c99" ,"$file_name","-o", "${file_base_name}.exe", "-lm", "-Wall", "&","start", "${file_base_name}.exe"]
    },
    "selector" : "source.c",
    "shell": true,
    "working_dir" : "$file_path",
}

的Linux

只编译:

{
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}", "-lm", "-Wall"],
"selector" : "source.c",
"shell":false,
"working_dir" : "$file_path"
}

编译和放大器;运行:

{
    "linux":
    {
        "cmd": ["cc","-std=c99" ,"$file_name","-o", "${file_base_name}", "-lm", "-Wall", ";", "./${file_base_name}"]
    },
    "selector" : "source.c",
    "shell": true,
    "working_dir" : "$file_path",
}

和保存这个扩展名为* .sublime建造

and save this with extension *.sublime-build

ST仅仅是一个编辑器,所以你不能把它作为一个输入流,你必须使用诸如bash shell中,zsh的,......这样做。

ST just is a editor, so you cannot use it as a input stream, you have to use a shell like bash, zsh, ... to do it.

这篇关于对C语言编程的崇高文本2构建系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆