一个简单的“javac”样式命令行 C/C++ Windows 7 编译器
在过去的几个月里,我在 JDK 和我选择的文本编辑器 (Notepad++) 的帮助下练习了 Java 控制台编程。我喜欢这种简单性,因为程序可以使用 javac
从命令行简单地编译并使用 java
运行。
现在,我正在寻找类似的 C/C++ 编译器,这样我创建一个 .c 或 .cpp 文件并在命令提示符中编译它,它所做的就是创建一个可以直接运行的“本机”可执行文件命令提示符。这样,就不需要任何臃肿的IDE了。我之所以寻找这么简单的编译器,是因为它是供高中生使用的,所以我建议尽可能避免使用任何 IDE,这样学生就可以练习 C/C++ 语言的所有概念,而无需使用它。必须去IDE。我可以使用哪个编译器来完成这项工作?另外,我必须在从 Windows XP 开始的所有 Windows 版本上工作。
Over the last couple of months I practiced console programming with Java just with the help of JDK and a text editor of my choice (Notepad++). And I loved the simplicity as a program can be compiled from the command line plainly using javac
and run using java
.
Now, I'm looking for similar compiler for C/C++, such that I create a .c or .cpp file and compile it in the command prompt, and all it does is create a "native" executable that can be run directly from the command prompt. Thus, without any need of bloated IDE. The reason I'm looking for such simple compiler is because it is going to be used by high-school students so I'm advised to avoid any IDE as far as possible, so students can practice all the concepts of C/C++ languages without having to go for IDE. Which compiler can I use that does this job? also, I must work across all the versions Windows starting from Windows XP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
你可以下载 MinGW ,它基本上是 Windows 的 GCC。
然后你可以简单地
gcc somefile.c
来创建一个可执行文件。You can download MinGW which is basically GCC for windows.
Then you can simply
gcc somefile.c
to create an executable.http://gcc.gnu.org/
gcc
是一个多平台 c/ C++ 编译器http://gcc.gnu.org/
gcc
is a multi platform c/c++ compilerVisual Studio 包含从命令行编译的功能。就像其他人刚才说的,你可以看看 cygwin/MinGW。我建议使用 Code::Blocks 或 Dev-C++。我知道您说过您不需要 IDE,但我强烈建议使用像我刚刚建议的那样的极简 IDE,或者至少 SciTE 或 Notepad++ 获得一些基本的语法突出显示并能够配置如果你愿意的话也可以构建工具。
Visual Studio includes the ability to compile from the command line. Like others just said you can look at cygwin/MinGW. I would recommended using Code::Blocks or Dev-C++. I know you stated you do not want an IDE, but I would highly suggest a minimalist IDE like the ones I just suggested, or at least SciTE or Notepad++ to get some basic syntax highlighting with the ability to configure build tools if you want as well.
MinGW GCC 绝对是最佳选择,但我推荐
nuwen.net
发行版 (http: //nuwen.net/mingw.html)。有一段时间没有使用它了(是的,unix!),但是如果是 IIRC,它在拆包后就已经准备好了一切。官方发行版......很难运行。MinGW GCC is definitely the way go, but I would recomend the
nuwen.net
distro (http://nuwen.net/mingw.html). Haven't used it in a while (yay unix!), but if IIRC, it comes with everything ready to go after unpacking. The official distribution is ... very hard to get working.一个非常简单的解决方案是 cygwin 和 MinGW,它提供了一个非常类似于 UNIX shell 的环境。然后您可以使用
make
实用程序来编译您的程序。A very simple solution woul be cygwin and MinGW, which provides an environment very similar to a UNIX shell. Then you can use the
make
utilities to compile your program.您当然应该考虑使用 MinGW GCC,但不要从 MiNGW 网页下载,除非您是某种受虐狂。获取 Twilight Dragon Media 打包的一份,网址为 http://tdm-gcc.tdragon.net。
You should certainly consider using MinGW GCC, but not by download from the MiNGW web page, unless you are some kind of masochist. Get the one packaged by Twilight Dragon Media at http://tdm-gcc.tdragon.net.
我也在 Windows 上通过命令提示符使用 VisualStudio,并使用 VS Make 文件。这样,我可以从不同的机器上挂载我的源代码,并同时在多个不同的平台(例如 Windows、Linux、Solarsi)上执行编译。
I too use VisualStudio on Windows from the command prompt and use VS Make files as well. That way, I can smb mount my source code from a different machine and perform compiles on several different platforms at once (e.g. Windows, Linux, Solarsi).