C++ Compiler for Windows without IDE? [closed]

I'm looking for just a compiler for C++ (such as g++) for Windows, that I could run in my cmd.

I'm using notepad++ as my text editor and I want to set up a macro in there that can compile my programs for me.

I do not wish to install Cygwin though.

Any suggestions?

1

8 Answers

MinGW. It's GCC/G++ for Windows. It's much lighter than Cygwin. The main difference from Cygwin GCC is that it doesn't try to emulate UNIX APIs, you have to use the Windows APIs (and of course the standard C/C++ libraries). It also doesn't provide a shell and utilities like Cygwin, just the compiler.

There is also a related system called MSYS, which provides a shell, etc. like Cygwin, but this is not required. MinGW itself will run in CMD (but I highly suggest using something better like Bash, for your own sanity).

8

Visual C++ has a command line compiler, cl:

10

If you don't have Visual Studio, you can download the Windows SDK (newer version) or the Windows Driver Kit for free, and then use the CL.EXE command-line compiler as suggested by @Greg Hewgill.

1

Digital Mars is excellent.

4

Probably not what you're looking for, but just to add to the question for completeness, the Intel Optimizing Compiler works great on Windows, Linux and Mac Intel platforms. A bit on the pricey side, but for highly optimized compiles on Intel processors it's second to none.

1

I think that the TDM-GCC from Twilight Dragon Media is more convenient than the official MinGW release. I found it simpler to install and use.

The old Borland C++ non-IDE compiler is freely available:

Here is Wikipedia's background on this free, Windows, command-line compiler:

With Windows 10, you can use g++ via the Windows Linux Subsystem.

Once you've set it up, install g++ using the bash terminal (this answer on Ask Ubuntu shows you how).

Bear in mind: you will only be able to run compiled C++ programs in the Ubuntu/bash environment, not from cmd/PowerShell directly:

C:\Folder> bash
User@Computer:/mnt/c/Folder$ g++ hello_world.cpp -o hello_world
User@Computer:/mnt/c/Folder$ ./hello_world

You Might Also Like