PDA

View Full Version : Xcode: not compiling




winterquilt
Dec 11, 2011, 12:29 AM
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:


#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)



jiminaus
Dec 11, 2011, 01:58 AM
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 (http://neilmonday.blogspot.com/2008/02/how-to-compile-basic-c-programs-in.html) might help you get started.

winterquilt
Dec 11, 2011, 08:05 PM
Very useful jiminaus, thanks very much!