简体   繁体   中英

A simple “javac” style command-line C/C++ compiler for Windows 7

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.

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 ++编译器

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 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.

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.

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 .

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 (eg Windows, Linux, Solarsi).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM