Cannot include files from /usr/local/include even though they are present - xcode

I'm not able to compile a project under Xcode Version 4.6.3 (4H1503) when using files located in /usr/local. The error is 'cryptopp/cryptlib.h' file not found. This is similar to a number of other questions, but the 'try this' mentioned in the other topics have not helped.
I have a directory with headers in them. The directory is /usr/local/ios-armv7/include. Within that directory the headers are located in cryptopp/. I am including the files with both #include <cryptopp/cryptlib.h> and #include "cryptopp/cryptlib.h".
In Xcode, I have /usr/local/ios-armv7/include and /usr/local/ios-armv7/include/cryptopp set in every place that will take a path for headers or include files. There are no target overrides. I verified the paths are being added to the command line through -I switches.
I've tried toggling ALWAYS_SEARCH_USER_PATHS. I've tried toggling recursive. I've also tried adding and removing the trailing slash (/). In between each attempts, I perform a full clean. I also used Organizer to remove all data. I even tried using a different compiler (GCC-4.2, which appears completely broken).
What is the trick to get Xcode to honor my search path?

Wow...What a pain. I just figured it out (was fighting this same issue for some time).
It looks like there are two sets of settings, one for the project, and one for the target.
Look to the left of your build settings pane. If you have the project highlighted, hit the 'targets' icon, and then you'll see there is another set of build settings. As soon as I added '/usr/local/include' to my 'Header Search Paths' section, it found the external headers.

I tracked this problem down to permissions on usr/local/ios-arm7. The permissions were 0600. I'm not sure how/why Finder was able to view them since I did not have permission. After chmod -R 0644 usr/local/ios-arm7, everything worked as expected. I could also remove all the extra paths I threw at the project.

Related

Error dialog "The file 'exclude' doesn't exist" when creating a new git-backed XCode project [duplicate]

When I create a new project in XCode 6.0.1, I got this error message: The file "exclude" doesn't exist
It seems to only impact the versioning of the files i.e. the generated stub files are not committed into github after the project is created.
What can cause this problem?
For me the issue was caused because I had previously created a project with the same name, and Xcode still had record of that.
To clear it out,
go to Window -> Organizer in the menu bar
Remove all of the repositories highlighted in red
To add your repository (if it's not being tracked for some reason),
Click the + (still in Window -> Organizer from the steps above)
Enter the path of your file
Make sure to change to Git from Subversion (if Xcode has Subversion set as default - it did for me.
I usually get this error if I initialize an Xcode project with a git repository, delete it and try to recreate it with the same name (casing doens't appear to make it sufficiently 'different'). Turns out, "Well I'll just start over" can leave some issues as well.
Hope this helps.
I had this issue as well, and I tracked it down to the .git-template folder included with Thoughtbot's dotfiles. Basically, Xcode expects its template folder to have info/exclude, and Thoughtbot's dotfiles don't. Creating that directory and file fixed the problem, as so (in the Terminal):
cd ~/.git_template
mkdir info
cd info
touch exclude
If you're getting this issue without Thoughtbot's dotfiles, you could probably look at ~/.gitconfig and use whatever templatedir is getting set as instead of ~/.git_template in the first command.

Working copy location of xCode SVN repository

Reference version: xCode 4.5.2
In Organizer-Repositories I see for each repository a "Root" folder and one or more folders related to the root. How I can see the working copy location related to each folder?
By right-clicking the folders I see only the link to the help and no options to see the actual location of the directory on my computer.
The reason why I'm asking this is that I added folders in my repository from different locations in my local filesystem. Now I need to find all the locations, remove them and put my working copy in a single directory tree to avoid mixing SVN working copy files with non-versioned files.
Many thanks for the help.
The xCode-Repositories interface for SVN seems incomplete (as appears from other questions/answers on it).
So I've resolved by removing the repository from xCode interface and re-creating it.
I now use "xcrun svn ..." command line interface for all the operations except the simple checkout/commit commands.

How do I use Mogenerator?

I installed Mogenerator. Now what do I do? How do I use it?
The first problem I have is that I have no idea where it was installed to. During the install process, it only let me select the hard drive to install it on, not the directory. The most natural location would be the Applications folder, but it isn't there.
Next, the readme (which I found online) states:
Xmo'd works by noticing when your
*.xcdatamodel is saved. If the model file's Xcode project item comment
contains xmod, an AppleScript is fired
that creates a folder based on your
model's file name and populates it
with derived source code files from
your model. It then adds the new
folder to your project as a Group
Reference and adds all the source
files to your project.
There are several issues with the above statement that aren't clear:
What does "the model file's Xcode project item comment" refer to? How can I make it contain "xmod"?
Is adding this comment and having mogenerator monitor the .xcdatamodel file the only way to use mogenerator? Is there any way I can manually run mogenerator so that it recreates the generated files?
One more caveat to be aware of: You have to already set the Class properties of your entities to something different than NSManagedObject. Otherwise Xmo'd won't do anything.
Note: Xmo'd currently doesn't work with Xcode 4/5, afaik.
What I do is just add a "MOGenerator" target in Xcode:
Go to your project and click on "Add Target..." in the "Targets" section.
Choose "iOS -> Other -> Aggregate"
Go to "Build Phases"
Select from the Menu "Editor -> Add Build Phase -> Add Run Script Build Phase"
Paste your MOGenerator command into the Run Script section, for example:
PATH=${PATH}:/usr/local/bin
cd "${PROJECT_DIR}/MyApp"
mogenerator --human-dir Classes --machine-dir MOGenerated --model MyApp.xcdatamodeld/MyApp.xcdatamodel --template-var arc=true
Now you can update your MOGenerator-generated by simply running this target.
mogenerator is a script that is installed into your developer directory as I recall. However it might be installed into the Xcode scripts directory under your ~/Library.
What do you mean by manually triggering the application? You can trigger a build by "touching" the data model. Any save on the data model will trigger the build
In Xcode if you select the model file and hit ⌘I you will get its metadata. Click on the comments tab and add xmod there. mogenerator looks for that comment to know if it should generate files.
Update
You can run mogenerator from the command line as well as have it monitor your files. Type mogenerator --help in the Terminal to see the options.
I searched my hard drive and found the following files:
The application is installed to: /usr/bin/mogenerator.
The /Library/Application Support/mogenerator/ directory contains some .motemplate files.
⌘I doesn't work in Xcode 4 any more. please check out the command line tool. Here is the doc
Studying line 22 of make_installer.command, I found that /Developer/Library/Xcode/Plug-ins/Xmod.pbplugin is also installed.
And then, searching mogenerator GitHub Issues for "uninstall," I found official instructions on how to uninstall mogenerator from the creator himself.
using mogenerator:
download mogenerator
run and build the mogenerator project
locate the built file in the product group
copy the built file in to /usr/bin directory
in the terminal copy this code and hit enter:
mogenerator -m /Users/hashem/Desktop/Projects/myApp/myAppModel.xcdatamodel -O /Users/hashem/Desktop/Projects/myApp/managedObjects --template-var arc=true
NOTE: here first I have entered myApp.xcdatamodel file path, and next path is the location of generated files. if the file path contains space character be sure to add \ character before space in the file path. like /desktop/xcode\ projects/myApp/....
enjoy!

How do I use a relative path in Xcode project settings?

How do I use a relative path in Xcode project settings?
All paths in Build Settings are assumed relative to the directory that contains the .xcodeproj file. Use the standard Unix path tokens
. project directory
.. parent directory
So if your project file is trunk/Mac/proj.xcodeproj, and your headers are in trunk/Headers/foo.h, you would add ../Headers to your Header Search Paths.
Also there are two paths: $SRCROOT and $SDKROOT.
In the upper left corner next to the build/stop buttons, click on the name of your project and Edit Scheme...
In the left column, click on Run
Click on Options
Put a check next to Working Directory: Use custom working directory.
You can then change the relative path to anywhere you want.
EDIT: This is for Xcode 4.1
For Xcode 5:
Click on Product -> Scheme -> Edit Scheme.
Then follow ulu5's instructions: Click "Run", Click on "Options", and check the box "Use custom working directory."
The various answers currently here which recommend setting the working directory when executing a project by editing the scheme and then choosing whatever directory you want are missing what seems like a key part of the question: Relative Path. If you just use the file navigator in the UI you'll get an absolute path, likely with your own home directory in it, which isn't so good if the project you're working on is shared with other people.
To specify a working directory relative to the project folder in there, find the "Working Directory" field in the scheme (In XCode 10.1, that's Product | Scheme | Edit Scheme, then Options, then check "Use Custom Working Directory"), and use $PROJECT_DIR to get the path relative to the project.
Using Xcode 9:
It may be intended for Xcode to always use relative file paths based on the directory that contains the xcodeproj, but sometimes this does not seem to be true, and in my case this may have been due to the fact that the project (directory and all) was copied from an earlier version. I had to do:
Target(top left)->Edit Scheme->Use Custom Working Directory
and then specify to use the directory containing my project file.

How do I keep Resharper Files out of SVN?

I am using VS2008 and Resharper. Resharper creates a directory _Resharper.ProjectName. These files provide no value for source control that I am aware of and cause issues when committing changes. How can I get SVN to ignore them? I am using TortoiseSVN as my interface for SVN.
EDIT: You guys are fast.
Here's a link to show the ignoring process in TortoiseSVN
Add the file names (or even the pattern _Resharper.*) to the svn:ignore property for its parent directory.
Gonna post an answer to my own question here as I read the manual after I typed this up. In TortoiseSVN, goto settings. Add
*ReSharper*
to the "Global ignore pattern". Adding items to the global ignore pattern means that these files will be ignored for any project you work on for the client with TortoiseSVN installed, so it might not be appropriate to use the global ignore in all cases.
You can also add specific files and directories to the ignore list for individual projects if you select this from the TortoiseSVN menu BEFORE they have been added to your repository. The "BEFORE" part is what tripped me up originally. Since this is a single developer project, I've been checking in binaries, etc. b/c it has no consequence for other developers, and the Resharper files got in there.
Store Resharper caches in system temp folder.
Check First setting page in r#.
Environment -> General -> System -> Store caches ..
Short answer: the "svn:ignore" property
Long answer:
# cd /your/working/copy
# export EDITOR=vi
# svn propedit svn:ignore .
(add "_Resharper.ProjectName" on its own line and write the file out)
Edit: erg... doh, just realized you said tortoise... this is how you do it with the command-line version of SVN
svn has an "ignore" property you can attach to a filename pattern or a directory. Files and directories that are ignored won't be reported in "svn st" commands and won't go into the repo.
Example: you have C source code in .c and .h files, but the compiler creates a bunch of .o files that you don't want subversion to bother telling you about. You can use Subversion's properties feature to tell it to ignore these.
For a few files in one checked-out working directory, for example myproject/mysource/
bash> svn propedit svn:ignore mysource
In the text editor that pops up (in linux, probably vi or whatever your EDITOR env var is set to), add one filename pattern per line. Do not put a trailing space after the pattern (this confuses svn).
*.o
*.bak
That's all. You may want to do a commit right away, since sometimes svn gets fussy about users making too many different kinds of changes to files between commits. (my rule is: if in doubt, commit. It's cheap)
For a type of file appearing in many places in a sprawling directory tree, edit the subversion config file kept inside the repository. This requires the repository administrator's action, unless you have direct access to the repository (not through svn: or http: or file:, but can 'cd' to the repository location and 'ls' its files). The svn books should have the details; i don't recall offhand right now.
Since i don't use Tortoise, i don't know how directly the description above translates - but that's why we have editable answers (joy!)
This blog post provides a example on how to do what you want on via command line svn.
http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/
These change will be reflected in TortoiseSVN.
I believe there is a way to do it via tortoise however i don't have a windows vm accessible atm, sorry :(
SVN only controls what you put into it when creating your repository. Don't just import your entire project folder but import a "clean" folder BEFORE doing a build. After the build you get all the object files or your _Resharper folder etc. but they are not version controlled.
I forgot: the svn:ignore command is another possibility to tell SVN to exclude certain files. You can add this as a property to the version controlled folders, e.g. with TortoiseSVN.

Resources