Compiling with Xcode

Discussion in 'Mac Programming' started by mm.vermelha, Sep 10, 2010.

  1. mm.vermelha macrumors newbie

    Sep 10, 2010
    Hello, there!

    I tried searching about compiling before begging for help, but it seems the more I read, the less I understand.

    I'm not a programmer and I know very little about it (which means nothing), but I need to install a C++ application, and I do realize that demands compiling the files, but I really have no idea of how. I do have the developer tools installed, from what I gathered I'll need xcode?

    I downloaded the software (, which got me a folder called src, which contains more folders - one in particular named Build as a makefile, a document with a long code.

    Where do I go from there? Can someone please make a step by step for dummies that I can follow?

    I swear, afterwards I'll study some programming.. I just need this to work, otherwise I'll have to install Windows and my Macbook loading Windows is my worse nightmare.

    Thank you! And I'm truly sorry if my question seems stupid, but I'm beyond lost.
  2. mac2x macrumors 65816

    Sep 19, 2009
    The very simplest way is to write and save your source file and compile in the terminal with g++; be sure you are in the directory your source file resides in.

    $ g++ -o {name your executable} {file_name}.cpp
    NOTE: The braces {} mean items that are replaced by the actual file name and any name you want to give your executable. Do not include the {} in the actual command!

    However, if you created an Xcode project, just click Build, or to run the executable if the compile is successful, Build and Go.

    [edit] Oh sorry, I didn't read your post want to know how to compile existing source code. My bad! :eek:

    [further edit]

    Someone please correct me if I tell you wrong (it's been a little while since I have done this), but the basic commands you need to compile and install a program from source code are:

    make install
    Here is a reasonably helpful looking site I ran across thanks to Mr. Google :)
  3. mm.vermelha thread starter macrumors newbie

    Sep 10, 2010
    First of all, thank you so much for answering me!

    I should have thanked you before, but I thought I should try and follow your tips first to tell you the good news if it did work. Which almost did!

    After doing all the steps, I got a number of errors.. apparently not only I need to compile the software itself, but also another 3 in order for it to work and link them afterwards.. I have no idea how to link them. If you don't mind me asking, do you know how that works?

    I'm starting to believe its easier to give up and run bootcamp.. :(
  4. Heath macrumors regular

    Aug 19, 2005
    There is a makefile included with that package, you are supposed use it to do the compiling for you.
    Looking in that file.. unless you have a lot of time and energy, it would be easier to find an alternate route since it doesn't appear that this release is meant to be compiled on OS X.
    Not to say it can't be done, but it would take time and knowledge of the system at a development level.

Share This Page