A bunch of ULTRA uber noob questions

Discussion in 'Mac Programming' started by mcmasterballer, May 1, 2008.

  1. mcmasterballer macrumors newbie

    Joined:
    Apr 29, 2008
    #1
    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?
     
  2. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #2
    You have to start a new Project. Pick Standard Tool.
     
  3. yeroen macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #3
    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
     
  4. Sander macrumors 6502

    Joined:
    Apr 24, 2008
    #4
    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
     
  5. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
    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
     
  6. mcmasterballer thread starter macrumors newbie

    Joined:
    Apr 29, 2008
  7. MrFusion macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #7
    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.
     
  8. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #8
    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
     
  9. MrFusion macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #9
    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.
     
  10. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #10
    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.
     

Share This Page