views:

1631

answers:

14

i'm using windows xp what would be a good c compiler? i want to learn c so that i can better understand the objective-c language for the iphone. i have a great background in php so hopefully something will make sense

ps:

what sections should i put more focus on when learning c in getting prepared for objective-c?

thanks

Duplicate:

+11  A: 

GCC is a free, open source, high quality, compiler. You can get it with cygwin.

Microsoft makes a C compiler that comes with Visual Studio, which is Microsoft's integrated development environment. You can download the "Express" edition of Visual C++ to give it a try.

Also, Intel makes a good compiler.

DasBoot
microsoft's c compiler is not a c compiler. they don't even pretend to want to implement c99. it is a c++ compiler.
nabiy
GCC knows Objective-C too.
Georg
And, GCC is what you'll eventually be using for iPhone development.
Mark Bessey
Microsoft's c compiler *is* a C compiler if you compile your code as C - but it is at best C89, not C99.
Arafangion
+8  A: 

The iphone uses the gcc compiler. This is available for windows using MinGW/MSYS or other compatibility packages.

Apple has Objective-C tutorials which assume very little C experience; I'd be tempted to just dive in. If you get stuck, then get K&R. (I don't know if php has types and pointers, otherwise you'll get stuck straight away)

Pete Kirkham
Actually it's MinGW and MSys, see history of edits.
mghie
+6  A: 

Visual C++ express is free, has a really nice IDE and compiles C code.

Laserallan
It doesn't compile Objective-C code, and that's the goal.
Pete Kirkham
The question doesn't state that he's looking for an Objective C compiler. He's looking for a C compiler to understand Objective C better.
Laserallan
+2  A: 

I'd use gcc by downloading cygwin.

Lehane
+2  A: 

Gcc is the way, you can install mingw which is a native windows port.

Dev er dev
+2  A: 

I also recommend gcc, but don't get too used to GNU extensions such as asprintf() if you want to write portable code. On some systems, strdup() is lacking, amongst many others. The compiler itself won't spoil you, but glibc will.

On the one hand you have POSIX, on the other hand you have ISO/c89/c99, then you have gcc.

I highly recommend gcc, with the above warnings in mind while you continue to explore other compilers. For instance, it can be fun to code around the limits of Lestes if you enjoy dabbling in C++.

In any event, gcc is very powerful, boasts superior optimizations and can be so -pedantic that you think its out to get you. But, don't forget about portable code .. or where/if portability kludges are actually appropriate.

Cygwin is also highly recommended, as DasBoot posted.

Tim Post
**Very** few platforms will be without strcpy() and, even for those, it can be built out of strlen(), malloc() and strcpy().
paxdiablo
And you want to stop writing something that uses it in order to implement it yourself because ... ?
Tim Post
Thinking more, I have spent too much time working on operating systems without a modern C library .. I'm probably over-defensive.
Tim Post
+1  A: 

I personally recommend MinGW. You can download it off SourceForge. It even works on a 64 bit configuration. I don't think it supports objective C. However, I found it useful while running C code on windows.

I don't have any idea about objective C and what parts of C you need to focus on while learning so as to make the transition easy. I'll leave that to someone with more experience.

batbrat
+1  A: 

gcc included in cygwin is a perfect first choice if you want to learn C on your Window XP platform. cygwin/gcc includes a basic Objective-C environment.

Anyway if you want to target iPhone, the best move would be to change to a Mac platform (which can natively run XP for smoothing the switch) in order to get Xcode, the Mac and iPhone development environment. You will also be able to learn CocoaTouch, the iPhone OS.

In parallel, you can register to the iPhone Dev Center for accessing all resources for learning iPhone programming.

mouviciel
+2  A: 

You could have a look at this free e-book Programming in C in 7 days as a starter where they use Dev-CPP for windows

Note

It includes only the first 7 lessons of the more complete e-book “Quickly Learn Programming in C”

epatel
+1 for DevCPP : nice free IDE
chburd
+2  A: 

Normally I would recommend Pelles C for programming C in windows. It is a good user friendly programming environment that has the best c99 compliance that i've seen... However, here I'm going to tell you that you should use gcc right off but not on windows. Use Linux (maybe Ubuntu?).

The reason I say to use gcc on Linux is because you want to develop for the iphone. I would suggest getting comfortable with the tools you are likely to use. I don't imagine you using the official iphone sdk (you'd need a Mac for that) so I think you'll be using the free tool chain. It does not compile on windows so switch to a supported platform and get comfortable with the tools.

nabiy
+1  A: 

If you're after a compiler that can compile both C and Objective-C, a GCC port to Windows is probably your best bet.

Timo Geusch
+1  A: 

When learning C, concentrate on pointers, arrays, strings and memory management - those are the things that will trip you up coming from a managed environment of any kind.

Jim T
A: 

The best thing about gcc is that it has a lot of features and supports the latest language standard. But for fast compilation and a nice programming environment you can't beat Lcc-Win32.

Norman Ramsey
A: 

GCC is the cheapest compiler, Intel the fastest, MSVC the most featured.

Crashworks