I am using Xcode to do C++ programming but the problem is when i build the program it doesnot creat a executable file like Turbo C++ creates a .exe file. What can i do to create such executable file on OS X environment using xcode.?
-
Perhaps this article could help you.SaschaM78– SaschaM782016-01-26 14:18:43 +00:00Commented Jan 26, 2016 at 14:18
-
@SaschaM78, consider paraphrasing the linked article and turning it into an answer :)Tobi Nary– Tobi Nary2016-01-26 14:49:37 +00:00Commented Jan 26, 2016 at 14:49
4 Answers
Follows this: File->Project Settings->under Derived Data, Click the Advanced->Click Custom, then choose the option Relative to Workspace->Done. Then build your code and you will see Product file package in your project path. I am using Xcode 8.2.1, hope it may help.
1 Comment
I'll try to summarise the following article and hope it'll help you get started:
How To: Compile and Run Basic C++ Programs in Xcode
- Start a new project: select File, New Project
- in the Application dropdown, pick your desired application type (i.e. "command line utility") and choose "C++ Tool"
- choose a location (and remember the path for later) and click Finish
- Start coding your application
- when you are done, click on the Build button
- now Finder and navigate to the project folder that you picked in step 3
- in it, you should find a file with the name of your project without any extension
- double click the file et voilà, your application should starts (in the example above, a terminal window should appear)
Let me know if it helped you solve your problem.
1 Comment
I got a simple solution for you got Product > archive and select distribute content and use the build option. Dig deep into the folder created and you can find the Mac executable file that'll run almost on any Mac.
1 Comment
you need to find the working directory of Xcode.
If you are working with C/C++, type system("pwd"); in your main function. This will print your working directory. In which you shall find the executable.
(I am not sure about other languages but there must be a substitute for system()).
your output should look something like this: /Users/your_username/Library/Developer/Xcode/DerivedData/Build/Products/Debug