views:

4428

answers:

20

I know C is not a very popular language but I need it for school. I'm fine working on Linux using gcc as my C compiler but would like a Windows solution. Any ideas? I've looked at Dev-C++ from Bloodshed but looking for more options.

+3  A: 

MinGW would be a direct translation off gcc for windows, or you might want to check out LCC, vanilla c (more or less) with an IDE. Pelles C seems to be based off lcc and has a somewhat nicer IDE, though I haven't used it personally. Of course there is always the Express Edition of MSVC which is free, but that's your call.

mjard
+13  A: 

You can get Visual C++ Express Edition straight from Microsoft, if you want something targeting Win32. Otherwise MinGW or lcc, as suggested elsewhere.

Pi
Visual Studio is great, but if they're using linux/gcc in class it's probably not the best option.
Joel Coehoorn
The problem being that C and C++ are different languages. C code doesn't always work in C++.
tloach
I believe that Visual C++ also has a C-mode compiler.
Pi
What C constructs won't work in C++?
Mark
Stroustrup clarifies it here: http://public.research.att.com/~bs/bs_faq.html#C-is-subsetI think the worst part is the sizeof() mismatches for chars and ints, plus the added keywords in C++.
Pi
The problem is not "What C constructs won't work in C++?" but rather the "What C++ constructs won't work in C?". It is easy to write "C like" code in C++ that is not valid C.
jussij
As @Richard said in comments: VC++ lacks C99 features.
J.F. Sebastian
+19  A: 

Er, C is still quite a popular language and you can use GCC on Windows by downloading MinGW.

Ben Hoffstein
A: 

Must Windows C++ compilers will work.

Also, check out MinGW.

nsanders
C != C++. There are differences such that not all C code will even compile in C++.
tloach
+8  A: 

You could always just use gcc via cygwin.

Unkwntech
This binds your app to the Cygwin DLL, which is really irritating, in my opinion.
Pi
I agree, but if the application has an installer one can bundle the the dll.
Unkwntech
Use the --mno-cygwin option when compiling under cygwin. This makes it compile MinGW binaries; no Cygwin DLL needed.
Colin
+1  A: 

Cygwin offers full GCC support on Windows; also, the free Microsoft Visual C++ Express Edition supports 'legacy' C projects just fine.

mdb
A: 

GCC works fine. Note that MSVC is not necessarily a valid solution because it does not support C99.

Dark Shikari
-1, GCC doesn't support C99 neither.
Bastien Léonard
A: 

Visual C++ Express is a fine and free IDE for Windows which comes with a compiler.

If you are more comfortable with commandline solutions in general and gcc in particular, MinGW or Cygwin might be more up you alley. They are also both free.

Hank
+4  A: 

I personally have been looking into using MinGW (what Bloodshed uses) with the Code Blocks IDE.

I am also considering using the Digital Mars C/C++ compiler.

Both seem to be well regarded.

Philip T.
Digital Mars C/C++ has been around for some time and does well. However you will run into linking issues for libraries as it uses a not so common object file format. If you can get source code that's not so much of an issue. Also, I've never used them but there are file format converter tools.
BCS
+6  A: 

GCC is ubiquitous. It is trusted and well understood by thousands of folks across dozens of communities.

Visual Studio is perhaps the best IDE ever developed. It has a great compiler underneath it. But it is strictly Windows-only.

If you're just playing, get GCC --it's free. If you're concerned about multiple platfroms, 'tis GCC again. If you're talking serious Windows development, get Visual Studio.

My $.02.

Kevin Little
+2  A: 

Be careful to use a C compiler, not C++ if you're actually doing C. While most programs in C will work using a C++ compiler there are enough differences that there can be problems. I would agree with the people who suggest using gcc via cygwin.

EDIT:
http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B shows some of the major differences

tloach
Can you elaborate on specifics on "enough differences"?
Mark
http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B
tloach
Any C++ compiler will also compile C - usually the compiler mode will be automatically selected based on the filename extension, but every compiler also has an option to force C or C++ mode regardless of the filename.
Michael Burr
A: 

It comes down to what you're using in class.

If the labs and the assignments are in linux, then you probably want a MinGW solution. If they're in windows, get Visual Studio Express.

Joel Coehoorn
A: 

Can't you get a free version of Visual Studio Student Addition from your school? Most Universities have programs to give free software to students.

Charles Graham
No such thing as a student edition. It's just Express Edition now, which anyone can get.
Joel Coehoorn
A: 

There have been a few comments pointing out that C is not C++. While that's true, also true that any C++ compiler will also compile C - usually the compiler mode will be automatically selected based on the filename extension, but every compiler also has an option to force C or C++ mode regardless of the filename.

So choose the free C++ compiler that you're most comfortable with gcc, VC++ Express, Digital Mars, whatever. Use the IDE you like best emacs, vim, VC++ Express, Code::Blocks, Bloodshed - again whatever.

Any of these tools will be more than adequate for learning. Personally, since you're asking about Windows, I'd choose VC++ Express - it's a great IDE, it's free, and it'll compile C programs just fine.

Michael Burr
A: 

You mean Bloodshed's Dev-C++? It's a nice visual IDE for C++ which uses MinGW's gcc for Windows as the back-the-scenes compiler. The project's been abandoned for a while (in my opinion, using Delphi to develop a C++ IDE is a very stupid thing to do to draw developers' attention), however there's nothing that stops you from using it and updating the version of MinGW's gcc it uses to the latest one - besides it's GPL-licensed.

Joe Pineda
A: 

You may try Code::Blocks, which is better IDE and comes with MinGW GCC! I have used it and its just too good a freeware IDE for C/C++.

yogeesh
A: 

GCC is not technically a linux specific compiler. Its a standards compliant c/c++ compiler, and I use it for windows programs on a daily basis. Its probably best that you use it until you become more comfortable with something else.

I recommend that you use the MinGW distribution of GCC. That will compile your programs natively for windows, using a standard library, etc.

If you're looking for an IDE, I have two recommendations. Visual Studio is the Microsoft version, and although it has its issues, it is an excellent IDE for working with the code. However, if you're looking for something a bit more lightweight, CodeBlocks is also rather good, and has the added benefit of being able to use basically any compiler you have installed (including several forms of GCC and the Microsoft Compiler that comes with Visual Studio) and being able to open project files fro other IDEs. Plus, it runs on linux too, so you could make that transition even easier on yourself.

I personally prefer GCC, but that's just me. If you really want the Microsoft Solution, VS is the way to go.

Nicholas Flynt
A: 

I use either BloodShed's DEV C++, CygWin, or Visual C++ Express. All of which are free and work well. I have found that for me, DEV C++ worked the best and was the least quirky. Each compiler has it's own quirks and deifferences, you need to try out a few and find the one with which you are most comfortable. I also liked the fact that DEV C++ allowed me to change the fonts that are used in the editor. I like Proggy Programming fonts!

Molex
+1  A: 

There is another free C compiler for Windows: Pelles C.

Pelles C is a complete development kit for Windows and Windows Mobile. It contains among other things an optimizing C compiler, a macro assembler, a linker, a resource compiler, a message compiler, a make utility and install builders for both Windows and Windows Mobile. It also contains an integrated development environment (IDE) with project management, debugger, source code editor and resource editors for dialogs, menus, string tables, accelerator tables, bitmaps, icons, cursors, animated cursors, animation videos (AVI's without sound), versions and XP manifests.

URL: http://www.smorgasbordet.com/pellesc/

Hideo