Solved

Compiler for C in WIN

Posted on 2006-10-31
14
393 Views
Last Modified: 2010-04-15

Dear fellows,

I have a desktop at home, with XP home edition. I wanna run my C programs in this computer. Where can I download a C compiler or whats the best C compiler for windows.

Thanks,

Freebuddy/
0
Comment
Question by:freebuddy
14 Comments
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
Personally I like Dev-C++ (www.bloodshed.net). It uses the Mingw compiler (ported GCC), and it's free.
0
 
LVL 12

Expert Comment

by:rajeev_devin
Comment Utility
You can check Miracle C Compiler also
http://www.c-compiler.com/
0
 
LVL 8

Expert Comment

by:deepu chandran
Comment Utility
Hi,
>> whats the best C compiler for windows

The Best one for windows is MS Visual C++ compilar.

Deepu
0
 
LVL 5

Author Comment

by:freebuddy
Comment Utility

but I have my source code written in C, how can  I ge a C++ compiler then. Or does it also translate C code?
0
 
LVL 6

Accepted Solution

by:
billtouch earned 50 total points
Comment Utility
Borland's very well known c/c++  compiler is available in the command line version free at: ftp://ftpd.borland.com/download/bcppbuilder/freecommandLinetools.exe

There is no GUI, but most popular editors let you configure them for compiles. This is the best optimizing c/c++ compiler available for the windows environment.

This compiler will compile you code as c if the extension is ".c" anb c++ if the extension is ".cpp".

Bill

0
 
LVL 8

Expert Comment

by:Exceter
Comment Utility
>> but I have my source code written in C, how can  I ge a C++ compiler then. Or does it also translate C code?

This may start an argument but... C and C++ are really the same language. C++ is a newer version of C with extra features/capabilities. Consequently, C++ can be considered a superset of C and all valid C code is valid C++ code.

This is a slight oversimplification but, generally speaking, it's true.
0
 
LVL 6

Expert Comment

by:GnarOlak
Comment Utility
>> This may start an argument but...

Only a small one :)

>>  ...all valid C code is valid C++ code.

This is not true.  Here is a simple example of valid C code that will generate an error when compiled with a standards compliant C++ compiler:

#include <stdio.h>

void main(void)
{
   printf ("Hello World\n");
}

C++ requires that main() return int.  C has no such restriction.  This is not the only way the two languages differ but it's the one I can think of off the top of my head.  
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 8

Expert Comment

by:Exceter
Comment Utility
I've had this argument before. For some reason, which I don't fully understand, this topic can spark "holy wars" among programmers. In response to your example, main returning void is inherently dangerous. I think you'd find that the C standard would have eventually forbid main returning void if the issue hadn't been taken care of in the C++ standard. That isn't so much a difference in the languages as a flaw in the C standard that was corrected during the jump to C++.

I didn't mean to say that the languages didn't differ, because they clearly do. C++ offers expanded capabilities and with that comes a few added restrictions. As I said, my statement was a slight oversimplification. My point was and remains that, in general, C++ can be conceptuallized as a superset of C.
0
 
LVL 11

Expert Comment

by:cup
Comment Utility
freebuddy - are you writing C code to the 1989 standard or 1999 standard?  If you are writing to the 1999 standard, then there is only one choice: gcc (dev-C++ if you want a GUI with it).  If you are writing to the 1989 standard, take your pick from http://www.thefreecountry.com/compilers/cpp.shtml

A warning about the latest Microsoft compiler - you will get tons of warnings.  I don't know what standard they're following but almost every standard C procedure call involving char* has been deprecated.  They also have support for something called managed code but that is just for the C++ side.

There is no best compiler: just like there is no best language or best computer.  Every one has its own quirks, good bits, faults and bad bits.  Some like CodeWarrior switch the positions of the OK and Cancel buttons.  Microsoft generates CLR unless you force it to go native.  If you're not fussy, you could try the Borland Museum.   TurboC was a pretty good 16-bit compiler.
0
 
LVL 15

Expert Comment

by:bpmurray
Comment Utility
Use Microsoft's Visual C++ Studio Express: http://msdn.microsoft.com/vstudio/express/visualc/

This is free and will handle C and C++ and provides all you might expect of a powerful dev environment.
0
 
LVL 6

Expert Comment

by:GnarOlak
Comment Utility
Exceter,

No holy wars here, just some healthy/friendly discussion :)

When the C++ standards committee laid down the rules for C++ they tightened up some of the sloppy loose ends in the C language.  In most cases programs wriiten in C and compiled with a C++ compiler will work but there are exceptions.
0
 
LVL 8

Expert Comment

by:Exceter
Comment Utility
Indeed. There are exceptions to every rule.

freebuddy asked if a C++ compiler translates C code to C++ prior to compilation. I was trying to make a general point that would help him/her better understand the difference between the two languages. C++ doesn't need to translate C code to C++ because C code is valid C++ code, with some minor exceptions.

The point is, why bother pointing out obscure differences between these two languages before he/she has an understanding of how remarkably alike they are?
0
 
LVL 6

Expert Comment

by:GnarOlak
Comment Utility
You are correct.  This was not the correct arena to quible about minor differences and wether or not C++ is a superset of C or a derivitive language.

This hijacked thread is now returned to the original poster with my appologies.
0
 
LVL 1

Expert Comment

by:nitinmathur5
Comment Utility
let's go open source. Use GCC for the C compiler,
http://www.gnu.org/software/gcc/gcc.html

If you are interested in C++, then use g++
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now