Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Xcode help

  1. Aug 26, 2008 #1
    So I took C and C++ classes in high school, and can remember most of it, but all of that was under Windows (devC++ to be exact). After switching to a mac in college I recently download Xcode and was a little intimidated with all the "developer tools". I don't really plan to use that stuff any time soon, but wanted a C++ compiler that runs native on macs. Anyways can I get some help on getting started and just compiling written programs. Like I said no help needed with the C++ just the enviroment. Thanks!
  2. jcsd
  3. Aug 26, 2008 #2
    If you've installed XCode, then XCode has already covertly installed GCC, which is the Mac OS X compiler. If you want to use GCC without bothering with XCode, just open a new window in Terminal and say

    gcc filename.c -o programname

    to compile filename.c, then say


    to run it.
  4. Aug 26, 2008 #3
    what is the difference between filename.c and programname.c?
  5. Aug 26, 2008 #4


    User Avatar
    Science Advisor
    Homework Helper

    By default unix compilers generate an output executable called a.out (for historic reasons) rather than filename.exe on a dos machine.
    You can tell gcc what to call the output executable with the "-o name" command.
    When you get to more complicated programs you might have 100s of .c files so you have to tell the system what you want the output to be.
  6. Aug 26, 2008 #5
    If you want to create a standard C++ class, create a new project that is a tool which is a C++ file. There's descriptions there. There's also the XCode manual that you can refer to which basically tells you which project to choose.

    It's complex-looking at first, but XCode isn't that hard to use after awhile.

    It's a great IDE, and this is coming from MinGW on the Windows platform.
  7. Aug 26, 2008 #6
    I'm sorry, can you be more specific? I am using Xcode 3.1 if that is any consolation. :)
  8. Aug 26, 2008 #7
    I highly recommend Aaron Hillegass's book Cocoa Programming for Mac OS X to learn how to use XCode and how to develop Mac applications.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook