Mac Xcode "run" is disabled

elodouwen

macrumors newbie
Original poster
Mar 8, 2014
5
0
hi
i am beginning with Xcode
i have typed a simple C program in a main.c file, itself in a .xcodeproject file
i have also typed a very simple Python program in a .py file
when i try to "run" these files, i can not because the "run" menu item is disabled
i can not manage to find on google neither on any forum any answer to my problem
could anyone help ?
thanks
Vinz
 

elodouwen

macrumors newbie
Original poster
Mar 8, 2014
5
0
hi
thanks
it is empty

since my message i have found en explanation on internet about how to create a pyhton Xcode project from the beginning

so i can find a solution for the .py file, i copy past it in a new theorically working python Xcode project
except that a new problem appears :
i was told to do this :
In the menu bar, click "Product" → "Scheme" → "Edit Scheme…".
Click "Run" in the left column.
In the "Info" tab, click the "Executable" field and then click "Other…".
Navigate to /usr/local/bin/python3 and click "Choose".
but the file python3 at this step is not clickable, only python3.3-32 is
at the end, when making "run" it does not work :
Code:
Xcode cannot run using the selected destination.
Choose a destination with a supported architecture in order to run on this system.
for the C Xcode project i confess i feel lost
the scheme is not empty and nothing is red but the compilation failed, and i do not find why, it does nt seem to be a code error but a "scheme" error

is there not an internet page where i can find simple instructions to complete schemes in order to begin learning programming ?

thanks for your reply !

Vinz
 

mfram

macrumors 65816
Jan 23, 2010
1,056
138
San Diego, CA USA
If you are making easy programs while learning programming, I would avoid Xcode. Xcode saves time when making full iOS or Mac OS Cocoa apps. But for simple command-line programs, my opinion is that it adds complexity you don't need.

You can use Xcode as your text editor then just directly execute the programs in the Terminal app. In Terminal, cd to the directory where you programs are. Python is easy, just 'python program.py'.

C programs must be compiled first. Make sure you have the Xcode command-line tools installed. That option is in the preferences panel in Xcode. Once the tools are installed.

gcc -o hello hello.c
./hello

The first command compiles the C program (in this case hello.c). The second command executes it.
 

MrFusion

macrumors 6502a
Jun 8, 2005
599
0
West-Europe
If you are making easy programs while learning programming, I would avoid Xcode. Xcode saves time when making full iOS or Mac OS Cocoa apps. But for simple command-line programs, my opinion is that it adds complexity you don't need.

You can use Xcode as your text editor then just directly execute the programs in the Terminal app. In Terminal, cd to the directory where you programs are. Python is easy, just 'python program.py'.

C programs must be compiled first. Make sure you have the Xcode command-line tools installed. That option is in the preferences panel in Xcode. Once the tools are installed.

gcc -o hello hello.c
./hello

The first command compiles the C program (in this case hello.c). The second command executes it.
Yes for languages other than obj-c (and maybe C++).

But for a CML objc-c app, just start a new "command line tool" project and replace the Hello world line by your own code.
Xcode takes care of the compilations and build settings. This does simplify things. I have no idea how to build a "make" file for example and I am not going to spend time on finding out. Xcode takes care of such things very well.
 

chown33

Moderator
Staff member
Aug 9, 2009
8,452
4,455
Pale blue comma
... I have no idea how to build a "make" file for example and I am not going to spend time on finding out. Xcode takes care of such things very well.
make has a number of builtin rules. If there's a "foo.m" in the working dir, and no makefile, what does 'make -n foo' say? The -n option tells make to just emit the commands, rather than running them.
 

elodouwen

macrumors newbie
Original poster
Mar 8, 2014
5
0
hi and thanks for the answers
- python works well now either with command line in the terminalfor python 2.7 or 3.3 either with the IDLE of python for python 3.3 (IDLE of python 2.7 not working)
- the instructions i founded on internet and followed to configure Xcode for Python does not work when i have to choose the executable when organising the "scheme"
- for C now, i founded one preference in Xcode dealing with command line, it says : "command line tool = Xcode 5.0.2 (5A3005)". But, now, if i cd to the folder where the .c is, then i type dcc -o file.c file it answers "gcc = command not found"
- and if i open a new C project, i dont find any "command line tool" blank project, i just have choice between "ios apps" and "mac apps" (and what about buinding apps for other systems ?) and in "mac apps" i can choose a C file. I guess that the fact that "run" is then disabled would n't occur if had found "command line tool" in the models proposed bu my Xcode
Vinz
 

elodouwen

macrumors newbie
Original poster
Mar 8, 2014
5
0
Here how the dialog after choosing create new project looks
à jeter.png
i begin to understand that there maybe be a problem with the version of Xcode
i have an older version of Xcode on an older mac and the window for new projets look like your picture.
the question is, so : what model should i choose among the models proposed by Xcode 5 ?
 

Dranix

macrumors 65816
Feb 26, 2011
1,008
410
left the forum
That is strange. I have the exact same version of Xcode5. Freshly installed on my virgin nMP when it arrived - so no old baggage from old install left over.

Did you by any chance install some template packs?

Edit: I think I found the problem. What you have opened is the "new file" dialog. You need the "new project" for creating new projects. New file is used to add elements to an already existing project like additional classes.
 
Last edited:

elodouwen

macrumors newbie
Original poster
Mar 8, 2014
5
0
thanks, for the time spent for me ! i was always afraid for very technical errors, and that was very simple indeed
now i can start
see you soon on this rich and cool forum
Vincent