views:

1549

answers:

15

Which C Compiler do you recommend for Windows (Not C++, C ANSI)

Related:

+2  A: 

I prefer to use gcc with cygwin.

Colin
If you compile under cygwin aren't you then tied to the cygwin libraries (cygwin1.dll at the minimum)? Additionally, I was under the impression that cygwin incurred a performance hit? (certainly all the executables such as ruby, python, etc are much slower in cygwin than native)
Orion Edwards
Yes, you are tied to the cygwin libraries. I think there may also be some license issues you may be bound by. There is some performance hit although not as much as you might think.
Evan
The advantage of cygwin is it provides a very close approximation of a POSIX environment, which facilitates porting code that was written in the UNIX world.
Evan
For C/C++ programs, you can use the -mno-cygwin option. This will make your programs independent of cygwin libraries.
Colin
+23  A: 

Mingw

Free. Open source. GNU. Compiles native windows binaries. Can't get much better than that.

Robert P
I would also recommend MinGW for starting C development, but for serious Windows programming I find VC++ much better.
Bastien Léonard
I installed the newest verson just to see. It is based on gcc 3.4.5 that's quite old if you see that gcc on Unices is now around 4.4 or the like.....
Friedrich
Actually, if you take a look at the downloads page (http://sourceforge.net/projects/mingw/files/) you'll see that the 4.4 release is the current 4.x release for MinGW's 4.x GCC compiler. You simply need to tell the MinGW installer to install the 4xx version instead.
Robert P
+21  A: 

Visual Studio.

Good compiler, great environment, and a fantastic debugger all in one package. The express edition is a free download.

Andrew Grant
VC++ lacks C99 features.
Richard
Very succinct, Richard. Was trying to find a good way to say the same thing. If you're looking for a good ansii C compiler on windows, I would not use Microsoft's.
Robert P
Express edition is pretty useless. Missing too many bits that are needed for real windows development...
Tim Ring
If you think express has features missing for windows development then good luck with gcc :)
Andrew Grant
For express you need to download the Windows SDK. This will give you all the headers, libraries etc. for Win32 development. (With VS it is included inside the install, but is the same.)
Richard
I used Express for many things. I wouldn't call it useless at all.
Nosredna
@Richard: GCC lacks C99 features too, so what do you recommend?
Bastien Léonard
What C99 features are not yet supported with GCC. The question for MSVC is simply, the only C99 stuff are the // comments. However MS-Debugger is quite useful and amang the better tools. What I found very disturbing is that all standard functions C89 like strcpy, memcpy and the like are marked "deprecated". This just shows a very massive ignorance IMHO... The feature I mostly miss in MSVC is that you have to open an scope with {} to declare variables in a function. You otherwise have to place them at the top...
Friedrich
+7  A: 

Here are some:

emirc
Having learned C 20 years ago using Turbo C, I've always liked Borland compilers, so +1. Also, there's a list of free compilers at http://www.thefreecountry.com/compilers/cpp.shtml
PTBNL
I once tried installing VC++ express edition on windows that I happened to use for some time. I found that I need to download and install many other things like MS SQL server. So I never used it.
Xolve
+4  A: 

I like LCC for Win32 for strictly C compilation. It's free for noncommercial use. http://www.cs.virginia.edu/~lcc-win32/

Jared
The 'no commercial use for free' thing is a bit of a bummer, though.
Bernard
Seriously, are there any reasons at all to use this over MinGW which is open source and optimizes better?
Zifre
"The 'no commercial use for free' thing is a bit of a bummer, though."Why?
Friedrich
+1  A: 

if you dont like any of the above you can try miracle-C

i prefer mingw + vim or visual studios but i cant post comments yet so....

but i have tried miracle-C and it wasnt bad

jimi hendrix
+4  A: 

If you look for performance optimization go with an Intel compiler. It's expensive, though.

By the way, it should produce optimized code that's pretty optimized for AMD machines as well.

Asaf R
I can confirm by direct observation (read anecdotal evidence) that Intel compiler produces fast code even for AMD machines.
J.F. Sebastian
The intel C and C++ compilers are some of the fastest C++ compilers I've ever worked with and have some of the best error messages of any compiler out there. If you can get and afford it, go for it.
Robert P
I just recently started using Intel's compiler inside of Visual Studio and I'm liking it a lot. It supports ANSI C99. I also agree with Robert P, first thing I noticed was how much easier is to read the error/warning messages. I'm excited to hear it produces fast code, I did not know that.
rem7
A: 

Open Watcom C/C++ - http://www.openwatcom.org/index.php

jussij
+1  A: 

If you're looking at an open source project, then I would recommend using a freely available (and preferrably open source) compiler. I scratch my head a bit at some open source projects I've seen that need visual C++* to compile on windoze...

I would use MingW as others have suggested. It is not particularly friendly (or that straight forward to download for that matter), however I'm pretty sure you can put put the Eclipse C IDE on top of it which would help a lot.

I've never used Open Watcom, but that would be another possibility for the same reasons. (In fact, I has a small C++ program I'm writing in Linux currently (with wxWidgets) that I'm going to port to windows as well, and I might give Open Watcom a try as well as MingW and see which was a more pleasant experience.)

*Yes, okay, I guess you can use the express edition, if the author has set it up so you're able to, that is....

Evan
A: 

Personally, MingW using Code::Blocks for the IDE.

VirtualBlackFox
A: 

gcc is a better choice over visual C++ for C99 compliance. C99 has very nice features such as variable argument macro and variable length array. gcc supports them but not Visual C++.

i did not realize gcc supports VLA's. Their c99 status page (http://gcc.gnu.org/c99status.html) says support for that is broken.
nabiy
+3  A: 

Pelles C is better than any of the above recommended for C99 compliance and imho if you are going to be coding in C it is better to get a compiler that supports the current standard. Pelles C is based off of LCC and is a complete development environment for windows (resource linker, project management, the works). It is my C compiler of choice because of it's focus on compliance with the c99 standard and it certainly provides a more complete development environment for windows than you are going to get with gcc.

nabiy
+1  A: 

If it's just a compiler you're after, I use gcc installed with cygwin. You'll have the added benefit of a hundred other gnu utils at your disposal as well.

Assuming you're also going to want a full blown IDE then I'd highly recommend taking a look at the Eclipse CDT project. http://www.eclipse.org/cdt/

The CDT (C/C++ Development Tools) Project provides a fully functional C and C++ Integrated Development Environment (IDE) for the Eclipse platform. The features include: support for project creation and managed build for various toolchains, standard make build, source navigation, various source knowledge tools, such as type hierarchy, call graph, include browser, macro definition browser, code editor with syntax highlighting, folding and hyperlink navigation, source code refactoring and code generation, visual debugging tools, including memory, registers, and disassembly viewers.

blak3r
A: 

Dev C++ is good too. It comes with gcc at its back end. But the project is probably dead by now.

Xolve
A: 

Hahaha Visual Studio it is the only used in Big Companies?, Let me tell you but that is not accurate, depend the field, for example in embedded I have seen lots of Metrowerks and Intel, Some shops use gcc or still using Borland C++ and anothers use VC++. The only good of VC++ it is somewhat good integrated IDE but their compiler and their support for the standard sucks big time and always have been.

I suggest as another people suggested for open source I would use MingW with Eclipse CDT or Pelles C are the best ones for ANSI C99

2c.