Simple C ++ compiler for windows

Thought that I would write something in C ++ instead of some interpreted languages ​​(because I need performance for something simple) and bypassed various tools.

At first I found that cygwin calls g ++, but cygwin.dll is required to run exe.

Then I tried mingw, but it seems to me that I need to include some DLL with the libgcc and libgstd distribution or something else that inflates the executable to about MB (I don't need many bytes to make a simple I / O file)

Then I looked at Visual C ++ 2010, since I already installed it, but it looks like I need to install 2008 only to use the .net framework 3.5. Well, I would not mind using 4.0, but I think that there are many people who do not have 4.0 on their Windows machines, and it would be an inconvenience to read the file.

What can I use, will this allow me to get around a small exe (e.g. a few kilobytes) that do simple one-time things that will work on most window machines? (since this only applies to Windows users)

Or should I just use C and go with gcc for mingw?

+7
source share
6 answers

At least some of the obvious candidates are:

VC ++: Starting with VC ++ 2010, it begins to support some of the features of C ++ 11. VC ++ 11 (currently in beta testing) adds a few more. It has pretty decent code generation, a debugger that many think of is the best you can get, and an IDE that produces pretty mixed reviews. Many of those who used them believe that older generations of IDEs (VC ++ 5 and 6) are better, at least in some way, but since then the compiler has improved so much that older IDEs do not really suit most people ( except support for old code).

MinGW: current gcc 4.7.0 STL function packages that (at least possibly) have slightly better support in C ++ 11 than VC ++. It includes quite a few ported Unix / Linux tools, but it is mostly a command line environment. If you want something like an IDE, you will have to install / configure it separately.

Cygwin: This is also based on gcc, but instead of porting the compiler to Windows, they ported Linux to Windows and ran the compiler on ported Linux. Obviously, I am exaggerating (a little), but not very much - Cygwin basically runs Linux / Unix code for Windows with minimal changes. The tools they supply are also suitable for this - it does its best to be a Unix-like environment that runs under the Windows kernel. This would definitely not be my first choice for any new development.

Qt Creator / SDK: This is another gcc package, but with an IDE. If you want to write code using Qt, this may be your first choice. Otherwise, I would probably avoid this - although it probably can work fine, it is written assuming that Qt is used by default.

Eclipse / CDT: you can find this package with a copy of g ++. At least the last time I tried, I needed to work a bit on the configuration before I could even get it to compile correctly. If you use Eclipse for other purposes, getting C ++ might be worth it. Otherwise, I personally would have avoided this.

C ++ Builder: In the days of Borland, it was Microsoft's biggest contender for dominance. Embarcadero seems to be trying to get him back to the mainstream again. The emphasis here seems to be much more on IDEs, GUI tools, etc., than the actual compiler. The compiler itself is somewhat behind gcc and / or VC ++. A starter edition costs $ 150 and limits product sales to $ 1,000, and at this point you need to spend most of your $ 1,000 to upgrade to Professional.

Clang: The most recently launched of the main compilers, but really working, being one of the best. Has some of the best diagnostic features of any compiler. LLVM goals that give it a lot of tools for runtime analysis, etc. Its main corporate sponsor is Apple, although although it works fine from OS / X (and now it is the default compiler) on Windows, you are much more on your own - AFAIK, you need a slightly different compiler installed and works (and really knows how to use it) to install it at all. On Windows, this is a bit like buying a muscle machine from the trash. With enough work, you may end up in the coolest car in town, but on Windows it is more a project than a tool.

Somewhat different to avoid altogether:

  • Any version of VC ++ until 2008. Just inferior to a C ++ implementation.
  • Any version of g ++ before 4.x. Again, the bottom implementation is C ++.
  • djgpp: pretty much the worst of the worst. It really targets MS-DOS with a (regular) DOS extender. An ancient version of gcc completes the horror.
  • OpenWatcom: also primarily targets MS-DOS. It uses a DOS extender which is better than djgpp, but which pretty much curses weak praise. The compiler is actually not even very close to compatibility with C ++ 98; C ++ 11 updates amaze me because they are unlikely to come soon (if ever).
  • Digital Mars: Walter Bright now works mostly in his own language D. Although the C ++ compiler is still available, the C ++ compilation is quite outdated.

Summary: If you want an IDE, VC ++ Express is a clear choice. If you care about the latest C ++ 11 features and don't mind working on the command line, MinGW is probably the best choice. Others definitely have niches, but I think most of them are worse if your goal is primarily to write new portable C ++.

+8
source

I am currently using the MinGW distribution by Stephan Lavavej at http://nuwen.net/mingw.html

I use it to create .exe files using gcc.

You just need to be content with the set of tools that it has included.

+5
source

Then I looked at Visual C ++ 2010 as I already installed it, but it looks like I need to install 2008 only to use .net framework 3.5

Uh, C ++ and .NET have nothing to do with each other.

Visual Studio is a C ++ compiler for Windows. Most of them have poor Windows support at best.

+1
source

I know that your question mentions “let me get along with a small exe file”, but if you are interested (like me) to sometimes just run C ++ code and not create an exe file, you might want to give Compile and Execute [CN10] Online to try.

+1
source

For a simple C / C ++ compiler, it’s hard to beat djgpp on windows: http://www.delorie.com/djgpp/

-one
source

IMHO: the only way to have an exe that is a few kilobytes these days is to do it using the .net framework, say 2.0, to be as compatible as possible.

I assume that no matter what tool you use, you are statically linking at least some parts of the standard library, which will violate your requirement for a small exe.

-one
source

All Articles