如何在 Sublime Text 2 中编译和运行 C 程序? [英] How do I compile and run a C program in Sublime Text 2?

查看:32
本文介绍了如何在 Sublime Text 2 中编译和运行 C 程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对编程完全陌生.我不知道如何编译 &在 Sublime Text 2 中运行一个简单的 C 程序.

I am completely new to programming. I have no idea how to compile & run a simple C program in Sublime Text 2.

(大学时我被要求使用 Turbo C++ 3.0,但我发现 IDE 相当古老.)

(In college I was asked to use Turbo C++ 3.0 but I found that IDE quite ancient.)

我使用的是 Windows 8 (x64).这是我点击构建时遇到的错误.

I'm using Windows 8 (x64). Here's the error I got when I clicked on build.

推荐答案

我意识到您提到您是编程新手,但是 此页面 可能仍能帮助您弄清楚发生了什么.基本上,看起来好像您没有在构建命令中正确指定要编译的 C 文件的名称.在该网页给出的示例中,要编译的文件由 $file 参数指定.

I realize you mentioned that you're new to programming but this page might still help you to figure out what's going on. Basically, it looks as if you're not specifying the name of the C file to compile in the build command correctly. In the example given at that webpage, the file to be compiled is specified by the $file parameter.

再次查看输出,尝试将文件另存为 *.c 文件--File->Save As 并将其命名为 Hello.c.在这种情况下,.c 扩展名很重要.

Looking again at the output, try saving your file as a *.c file--File->Save As and call it something like Hello.c. The .c extension is the important thing in this case.

编辑 2:在第 4 行的末尾不需要两个 ;.这不太可能是你的问题(应该可以编译),但它不需要,你不应该进入习惯.

EDIT 2: You don't need two ; at the end of line 4. That's unlikely to be your problem (should compile ok) but it's not needed and you shouldn't get into the habit.

这篇关于如何在 Sublime Text 2 中编译和运行 C 程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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