Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mcmasterballer

macrumors newbie
Original poster
Apr 29, 2008
2
0
But I downloaded xcode 3.0, opened new file, went to c file and wrote some code that I'm 100% sure is correct but how do I make my project run? BTW I've never programmed before on mac but I have in the c sharp program for windows. Umm... I tried to go to the run option but thats not available. Also the template given looks like this
/*
* untitled.h
*
*
* Created by Gurpreet Bhachu on 01/05/08.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*
*/

So do i start writing code here?
 

yeroen

macrumors 6502a
Mar 8, 2007
944
2
Cambridge, MA
The best thing you can do for yourself right now is to not use the Xcode IDE, but learn how to edit, compile, and run programs from the shell command line, and graduate to the complexity of the IDE as the complexity of your project warrants.

Learning on the Windows platform engenders some bad habits, prime among them complete dependency on heavy, GUI-driven, IDEs. Change platforms or IDEs and you're back to square one, as seems to be the case here.

Having heeded my unsolicited advice, just follow this pattern:

Edit file hello.c:

#include <stdio.h>
int main (int argc, char *argv[])
{
printf("Hello World\n");
}


Compile:

gcc -g -o hello hello.c

and run:

./hello
 

Sander

macrumors 6502a
Apr 24, 2008
521
67
The best thing you can do for yourself right now is to not use the Xcode IDE, but learn how to edit, compile, and run programs from the shell command line, and graduate to the complexity of the IDE as the complexity of your project warrants.

Hear hear.

If you're going to learn to program, you're going to get a lot of new stuff thrown at you. If you focus on learning the programming language first, without getting side-tracked by all kinds of cool features from a certain IDE, you can quickly learn some stuff which is "universal".

Good luck,
Sander
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I agree completely. Not sure what kind of programming you did on C# on windows, or what IDE you used (I assume VS or VS Express, I don't know of others), but starting with XCode is not a good plan. It makes some easy things harder than they should be when you don't know your way around, and you don't need the complex things it can do right away.

We probably need a "I've never programmed (or never programmed for the Mac) before, I want to make an iPhone application, what do I do?" FAQ on the top of these forums, as this comes up often.

The order things need to go in, IMO:
Learn C
Learn Objective-C, it is a proper superset of C
Get familiar, at least, with the Cocoa APIs
Get familiar with the Cocoa Touch/iPhone APIs
Start coding your App.

Somewhere around familiarizing oneself with Cocoa you might start needing XCode to handle your framework importing needs, etc. but not before that.

-Lee
 

MrFusion

macrumors 6502a
Jun 8, 2005
613
0
West-Europe
The order things need to go in, IMO:
Learn C
Learn Objective-C, it is a proper superset of C
Get familiar, at least, with the Cocoa APIs
Get familiar with the Cocoa Touch/iPhone APIs
Start coding your App.

Somewhere around familiarizing oneself with Cocoa you might start needing XCode to handle your framework importing needs, etc. but not before that.

-Lee

Why learn C? Just go straight to objective-C.
I went from pascal to java to obj-c to obj-c with some typical c stuff added.
Objective-C is a nice, powerful language.
And yes, get your hands dirty on the command line. Or if you insist using xcode, skip all the graphical stuff until you feel comfortable with the language and basic (file) input/output on the command line.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Why learn C? Just go straight to objective-C.
I went from pascal to java to obj-c to obj-c with some typical c stuff added.
Objective-C is a nice, powerful language.
And yes, get your hands dirty on the command line. Or if you insist using xcode, skip all the graphical stuff until you feel comfortable with the language and basic (file) input/output on the command line.

For someone with programming experience, going right to Objective-C would be fine. If one had none, I would insist on C as a foundation. In my opinion, at least, Objects just muddle the initial learning process.

-Lee
 

MrFusion

macrumors 6502a
Jun 8, 2005
613
0
West-Europe
For someone with programming experience, going right to Objective-C would be fine. If one had none, I would insist on C as a foundation. In my opinion, at least, Objects just muddle the initial learning process.

-Lee

One is procedural, another object orientated. Is it really necessary to start with procedural, before going to object orientated? I am not sure knowing a procedural language helped in wrapping my head around object orientated. You could still learn basic loops and conditional in an object orientated language.
 

Cromulent

macrumors 604
Oct 2, 2006
6,812
1,100
The Land of Hope and Glory
One is procedural, another object orientated. Is it really necessary to start with procedural, before going to object orientated? I am not sure knowing a procedural language helped in wrapping my head around object orientated. You could still learn basic loops and conditional in an object orientated language.

I'm not so sure. I started trying to learn Java ages ago but gave up as the OOP stuff confused the heck out of me. Now that I have a reasonable understanding of C I'm finding Objective-C and Python much much easier to understand.

Plus there are much better books available for new programmers in C than there are for Objective-C.

Edit : It is also easier to go from a procedural language to an OO language than going from an OO language to a procedural language I would imagine. If I only knew how to do something using the cool features available in Objective-C for instance I'd find it hard to get my head around doing it in straight C.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.