Xcode: not compiling

Discussion in 'Mac Programming' started by winterquilt, Dec 10, 2011.

  1. macrumors regular

    winterquilt

    Joined:
    Feb 18, 2008
    #1
    I wanted to program some shell scrips for the Windows environment in C or C++, not sure how to do that, but I have a few beginner examples. Anyway, I used a Mac (of course) and was told I could do this and compile them in Xcode, but I find, even having just downloaded v3.2.6 from Apple (I am using Snow Leopard) that the Compile menu s completely greyed out.

    I read online that it could well be the GCC compiler I am missing but I don't get any of that, plus, I've just installed the Xcode developer tools fresh and I still have the problem.

    Here is the code I am trying out:

    Code:
    #include <iostream>
     
    using namespace std;
     
    int main()
    {
      cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
      cin.get();
     
      return 1;
    }
    
    Should be simple right, well, I can't compile it so I don't know if it'll work.

    I said I wanted to code for Windows and execute shell commands I know, but was led to believe I could do this all on a Mac, which I think would be nicer.

    Am I barking up the wrong tree?

    Thanks in advance.

    (I have done a search of this forum and been all over the internet, but still cannot find a sollution)
     
  2. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    Did you create a project, or did you just create a new file? XCode needs a project in order to be able to compile.

    This blog post might help you get started.
     
  3. thread starter macrumors regular

    winterquilt

    Joined:
    Feb 18, 2008
    #3
    Ah!

    Very useful jiminaus, thanks very much!
     

Share This Page