Project Builder and C

Discussion in 'General Mac Discussion' started by P-Worm, Sep 6, 2003.

  1. P-Worm macrumors 68020

    P-Worm

    Joined:
    Jul 16, 2002
    Location:
    Salt Lake City, UT
    #1
    I was programming in C in Project Builder and eveything is going great. Until I try to run the program. At school, I program in Emacs and everything is a little bit different. In Emacs, when I compile, it makes a new folder and drops the ".c" ending. When I build in Project Builder, I have now Idea where it goes or how to run it. Everything compiled correctly and I don't know what happened. Can someone help?

    P-Worm
     
  2. mikeyredk macrumors 65816

    Joined:
    Mar 13, 2003
    #2
    it should drop the file into your home directory
    and you can run your program from project builder
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    It actually depends on you settings. Did you start a new project? If so PB will probably have created a directory called the same as your project which will contain all your projects files. After a compile you should see a directory called build in the project directory. Look in their for your app/binary.
     
  4. P-Worm thread starter macrumors 68020

    P-Worm

    Joined:
    Jul 16, 2002
    Location:
    Salt Lake City, UT
    #4
    Yeah I see it. How can I get it to run, like in the Terminal? At school we run everything through the Xterm in their Unix X11 thing.

    P-Worm
     
  5. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #5
    You could use the build and run option, which is both an icon and a menu option.

    When you create the project, it does ask you where you want it. Simply take a look at where the project is, and then, you'll find the source files as well the as project file in that folder. The created programme is within in the build folder within the project folder.

    I find it easier to:

    1) rename the main.c file in PB to something more useful, such as the assignment name.

    2) compile from the Terminal application using cc -o MyProg MyProg.c (where MyProg is the name you've given it.)

    3) run it with ./MyProg (sometimes, PB won't get the output from the programme properly.)
     
  6. P-Worm thread starter macrumors 68020

    P-Worm

    Joined:
    Jul 16, 2002
    Location:
    Salt Lake City, UT
    #6
    Thanks. That was exactly what I needed.

    P-Worm
     

Share This Page