Taking C beginner course. Newbie building process question

Discussion in 'Mac Programming' started by xlopez, Nov 17, 2007.

  1. macrumors member

    Joined:
    Jul 13, 2006
    Messages:
    30
    #1
    Thanks for entering this thread. I'm having trouble running a .c file I've compiled. In Xcode, when I get Shift + Command + R the simple .c program runs in a log window and an .app file is placed in the build directory of my project. I assume that since I haven't developed an interface for the program, when I click on the .app file, nothing happens. Is that correct? Also, when I try to build the .c file through terminal and I type gcc -o applicationsource.c appname.app, the resultant .app file doesn't run because the classic environment is not supported in leopard. These all lead to the same question, how can I just write a program that can open in any recent mac computer, that just shows an input window followed by an output, as that is all I want for the moment, because of my beginner knowledge. Before you suggest what seems to be the easiest thing to you, remember that I've just started coding in c and I don't understand concepts of program linking, interfaces and the like. So in that case, what I would like is for you to guide me into what I should do, so that I could share a .app program with someone else. Thanks again.
     
  2. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Messages:
    2,579
    Location:
    Portland, OR
    #2
    You'll want to use Xcode's "commandline tool" template. It sounds like you grabbed the Cocoa App template, which is going to be less useful for a C class.

    Personally though, for basic C stuff I just pull out SubEthaEdit or another lightweight editor, and use GCC in terminal.
     
  3. macrumors member

    Joined:
    Jul 13, 2006
    Messages:
    30
    #3
    Are you talking about the "Project Type" screen? I always choose "Carbon Application" from the list. Does that have anything to do with it? In any case, can you guide me to "choosing a template", in this case the commandline tool one? Thanks a lot.
     
  4. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Messages:
    2,579
    Location:
    Portland, OR
    #4

    Ah ok. I didn't remember the name exactly. Yeah, Carbon is not what you want.
     
  5. macrumors member

    Joined:
    Jul 13, 2006
    Messages:
    30
    #5
    I succesfully generated a "Unix Executable File" but this file doesn't run on a friend's computer which is running Mac OS X 10.5 on an intel based laptop. She just clicks on it and the TERMINAL application doesn't open. Does this mean that anyone without gcc installed on their system won't be able to open it? Thanks.
     
  6. macrumors 68020

    pilotError

    Joined:
    Apr 12, 2006
    Messages:
    2,234
    Location:
    Long Island
    #6
    If I click on a console application, it just pops up a window and tells me it can't run because the Classic environment is no longer supported.

    If you open terminal then execute it, it should work...

    I'm not sure how you would tell OS X to open a terminal and execute the application. Maybe someone here can tell us...
     
  7. macrumors newbie

    kangorillas

    Joined:
    Sep 18, 2006
    Messages:
    9
    Location:
    South Florida
    #7
    Just out of curiosity... Is this an online course?
     
  8. macrumors member

    Joined:
    Jul 13, 2006
    Messages:
    30
    #8
    No. I'm studying Software Engineering and I'm taking an "Algorithms and Programing" first year class which is about basic computer algorithms and how we can use them. The class is being given in C, so it's not really a C language class. Almost everyone there has windows and they jsut compile and run their .exe files, but with us mac users it's a mess, because there's no real .app file, just an unix executable file that runs if you have gcc installed on your system, at least that's what I understand so far. I just run it on my computer and it's okay, but I want to share it so other people can run it on their computers, and that's what I want to know. Thanks again.
     
  9. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Messages:
    2,579
    Location:
    Portland, OR
    #9
    You shouldn't need GCC installed; Just Terminal, which is built in.
     
  10. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Messages:
    5,988
    Location:
    The Land of Hope and Glory
    #10
    Just cd to the directory the application is in within Terminal and type ./*APP NAME* obviously changing app name for the relevant name.

    That will run your application. Forget about the Finder when you are developing command line tools.
     

Share This Page