Question:
A simple “javac” style command-line C/C++ compiler for Windows 7?
?
2012-01-18 06:08:22 UTC
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.
Three answers:
2012-01-18 17:15:10 UTC
Borland has a command named "bcc32".

MinGW has a command named "gcc" (recomended for me).

Turbo C has a command named "tcc".

Visual Studio has a command named "cl".
michael
2012-01-18 06:33:06 UTC
I agree that Cygwin & gcc/g++ is the way to go (but you can still use an IDE other than MSVC, eg netbeans (my pref) or eclipse).... But if you want the exe to be portable use mingw versions -> http://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw





Edit: please teach how to debug / step thru code. I hate having to show every new hire how to do such basic tasks. That's why you use an IDE. They really don't build usable debuggers anymore that are separate from the editors like they used to.
cja
2012-01-18 06:15:12 UTC
Download and install cygwin from here: http://www.cygwin.com/



You can compile/link with gcc and g++ at the command line in the cygwin terminal window ... exactly what you're looking for.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...