3

I've downloaded and installed google-sparse_has_map with

./configure 
make
make install

As instructed, without a problem, but when I included it in XCode, like this:

#include <google/sparse_hash_map>

I receive the following error:

Google/sparse_hash_map: No such file or directory.

It is installed in /usr/local/include/

how do I show this directory to XCode?

ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
Deniz
  • 1,481
  • 3
  • 16
  • 21

2 Answers2

3

Take a look at my graphic below:

Settings

You need to tell Xcode where the library and the include files are. Add paths to the "Header Search Paths" and "Library Search Paths" of your project settings.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • how can I add this for all my projects by default? Thank you! – Deniz Jan 25 '12 at 03:12
  • 1
    Myself, I wouldn't add this to my default (you never know what old, outdated or crazy stuff you might accidentally pick up from `/usr/local`), but if you are determined to make it happen, check out [this StackOverflow question](http://stackoverflow.com/questions/33720/change-templates-in-xcode) about modifying the template apps & projects served up by Xcode and you may be able to add in search paths there. – Michael Dautermann Jan 25 '12 at 03:17
1

You need to tell your project where to find the include folder

"/I /usr/local/include/" or "-I /usr/local/include/"

Of course it depends on where the folder is relative to the project directory.

From http://forums.macrumors.com/showthread.php?t=227636 the XCode compiler options can be found by doing the following:

Select the name of your project from the Groups and Files list.
Click the Get Info button in the project window toolbar. An information panel for the project will open.
Click the Build tab in the information panel.
Choose GNU C/C++ Compiler from the Collection pop-up menu.
Dennis
  • 3,683
  • 1
  • 21
  • 43