After I write a program, correct or not, I am not able to compile it or run it. The option is there but it is not highlighted. And if I use other IDEs and try to run the program, the application simply crashes. Is there any solution to this?

Assume that we use the following program:

#include<stdio.h>

#include<conio.h>

void main()

{

printf("Hi");

getch();

}


There is no mistake in the program, whatsoever. Yet the option for run or build still isnt available. I have tried it on CodeBlocks also and the application simply crashes. I have been trying to figure this out for the past two years and still haven't found a solution to this problem. Been to many apple stores also, and they couldnt help me either and told me to come here. I don't want to keep using windows for coding anymore if I know I have a better OS with better software in it that makes coding much better and easier.

What versions of the OS and of Xcode are you using?

Which Mac model?


Try this:

Start Xcode, create a new project, select OS X -> Application -> Cocoa Application.

Give it a name and save it somewhere.

Build and run with no changes.


Can you get that far? Does it crash?

I have the latest version of OS and Xcode i.e.

10.11.4 (OS)

7.3.1(Xcode)


It did not crash, it said the build was successful. Do you know what it is that I am doing wrong here?

You need to create a command-line tool project to use your code in Xcode.


The code you listed won't work on a Mac. OS X does not support the conio.h header file. That's why your program crashes in CodeBlocks. Get rid of the line of code that includes conio.h. Stick with the I/O functions in the standard library and don't use any of the conio.h functions.

Basically, I don't even know how to use Xcode. Can anyone teach me how to use Xcode for C/C++ programming? I have tried Xcode tutorial but it doesn't help.

I wrote a tutorial on how to use Xcode for command-line programs. I would give you a link to it here, but putting external links in a post puts the post in moderation on this forum and the moderation takes days. If you do a Google search for xcode command-line programming, my tutorial is currently the second hit. The title is Creating a Command Line Application with Xcode, and the URL starts with meandmark.

To avoid perpetual TSA quality wait times for moderatiion OK here, break the url, like this:


h t t p : / / www.SomeServer.com

After I write a program, correct or not, I am not able to compile it or run it. The option is there but it is not highlighted. And if I use other IDEs and try to run the program, the application simply crashes. Is there any solution to this?
 
 
Q