How do I build a C++ program as a .app program? - xcode

I am trying to build a c++ program I wrote as a stand alone .app that I can distribute. I didn't notice till now that it is just building a unix executable.
I am using Xcode 4.
Also if my program has dependencies on libraries can I package them with the app or do I have to get people to install the libraries?
Thanks.

I came across this post when trying to make an .app file of my c++ program in Xcode. So these steps might help someone else out.
Click Product->Archive in the top menu.
Then select the "Distribute..." button (under "Validate...").
Select "Export as" and "Application" in the drop down box.
Click "Next" and save the file where you want.

Related

Can't get real path for source - Xcode, SFML, C++

I am new to SFML, and followed SFML & Xcode tutorials for SFML 2.5 to try to get a basic program build and run.
After copying the content of Frameworks to /Library/Frameworks and content of extlibs to /Library/Frameworks, and the Xcode templates, I was able to create a sample app via Xcode using the SFML App template.
When I tried to build it, it failed with the following error:
Any idea what I did wrong?
Help is much appreciated!
Seems like a post build script is pointing to incorrect paths. Here's how to fix this.
In Xcode click on your project's name in the root of the project navigator (where you see the source files) so you can see its configuration.
There should be a header called "build phases". Click on that.
Expand the item called "Run Script".
If you followed the tutorials from SFML to setup your environment, edit the area under the comment "Settings" at the top of the script to look like this.
#These 3 are probably pointing to a directory under
#/Users/SFML right now which is not on our machines
SFML_DEPENDENCIES_INSTALL_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_FRAMEWORK_PREFIX="/Library/Frameworks"
CMAKE_INSTALL_LIB_PREFIX="/usr/local/lib"
#This Doesn't Change
FRAMEWORKS_FULL_PATH="$BUILT_PRODUCTS_DIR/$FRAMEWORKS_FOLDER_PATH/"

how to find xcode 7.2 .app file location on the mac

I have project in Xcode 7.2 and i need .app file it generates to be able to point it to monkey talk scripts to run test.
i could not find any options to see it.
i was looking in ~/Library/ locations etc.
but no results. is there a way to find build location etc in the Xcode 7.2
The monkey talk target only accepts the .app file
or if there is a way to run mt scripts directly from the installed location on simulator that will help too.
In Xcode if you click on Window -> Organizer you will se a list of build archives. You can right click on then (if there is any of course) and click on Show in Finder. That will be the location of the .xcarchive that contains inside it the dsyms, plists and the .app which I suppose is what you are looking for. In order to archive a build you have to click on Product -> Archive. I hope that helps.
The full path on my machine is /Library/Developer/Xcode/Archives/<#date#>/<#project#>.xcarchive/Products/Application/<#Application#>.app

SDL and SFML not working with Xcode 5

I got used to VS quiet well, but hopped to Mac. OS X is fantastic, and I'm playing with Xcode now. I do not like it... For Apple related stuff it is great, but God, SFML and SDL are not working! I got same problem with both! I installed Command line Tool, and installed both Frameworks and everything, made templates, but when I build my main.cpp, it get's broken in same place. On the line #import <Foundation/Foundation.h> it says can't find Foundation/Foundation.h, and I tried adding path, and fiddling all the things in build phase, but still nothing. It is so frustrating! I can't wait for JetBrains to release their C++ IDE. Can anybody help me with these? I tried recompiling SDL2, since it was crashing Xcode but then I got that Foundation.h is missing. SFML is showing me the same thing, even if I created template and everything else is perfect. Can anybody help me?
It sounds like you need to add Foundation.framework to your Xcode project. To do that:
Click on your project's icon in the Project Navigator pane. This will show you the various targets in your project. (There's probably only 1 if you've just made the project.)
Click on the target you're trying to build, then click the "Build Phases" tab.
Twirl open the section named "Link Binary With Libraries" and click the "+" button. It will display a dialog with a list of the standard frameworks. There's a search box at the top. You can just type "Foundation" and it will find it.
Select it, and click "Add". That should add it to your target.

Adding an external executable in Xcode 4

I would like to debug Firefox code on OS X.
I'm reading from this page and it tells me:
Now you need to add the executable. Select Project > New Custom
Executable and type a pretty name, then click the Choose button to
locate the .app file that you want to debug (Mozilla.app, Firefox.app,
DeerParkDebug.app etc). The .app file is
But with xcode 4 there is no Projects menu. I can't seem to find out how to add a custom executable. I have successfully built Firefox but I just can't debug it because I don't know how to add an executable in Xcode 4. I suspect the steps in the link were for Xcode 3.
Under Xcode 4 you will have to edit a scheme to run an executable. Select a scheme (or duplicate one for your target) then select the "Run" phase. You will see an "Executable" pop-up menu, select which executable you wish to use then run your target. There are other settings for specifying the arguments, etc just as in Xcode 3.

How do I Create a link to an executable Installed by Visual Studio Setup Project

I am working on a visual studio setup project. I want the setup project to install the executable for a windows forms project, and then put a link to that executable in the Programs Menu on the target machine. In the Setup Project I clicked 'Add'-> Project Output... and selected the Primary Output from my WindowsForms App. So that should install the program right? Ok, so next I went to the File System on the Target Machine, right clicked on the Primary output from WindowsForms App and said Create Shortcut. I then moved that shortcut into the User's Programs Menu folder.
I tried running the installer and it works ok but for some reason whenever I click shortcut that is in the Programs Menu It actually installs the program before running it every time. Why does it do this? Did I add a shortcut to the wrong thing? If I navigate to the directory application directory and click the .exe file it just opens the program without doing any install. Does anyone know what is going on?
I read somewhere that I could actually make a shortcut in windows explorer that targets my output .exe and then add that file to the installer project but I can't see how that would work on every machine it gets installed on.
I think this is how I did it... been a while tho.
Application Folder
Primary Output From MyProjectName (Active)
Right-Click => Create Shortcut
Then
Users Program Menu
Right Click => Add Folder
Go back to "Application Folder"
Move the shortcut over to the program menu
Rename it to whatever you need. The "Type" should say "shortcut"
Is that kinda what it looks like for you right now? Something in
* User's Program Files
* My App Folder
* Start My Application (shortcut)
And need I say, MS's install projects are a nightmare :) Just open the .VDproj and look. I never thought i'd say I like the csproj xml format, but in comparison...
The problem was not actually in how I was creating my shortcut but rather what the shortcut was pointing too. The executable that the shortcut was targeting was not in the main installation folder and for some reason it didn't like that. Restructuring the install directories a bit fixed it.

Resources