Search code examples
c++macosxcode5osx-maverickslibusb

Adding "libusb.h" search path to Xcode 5 (OS X v10.9 (Mavericks))


I am trying to get the Kinect library "libfreenect" to work on OS X v10.9 (Mavericks). It always ends in "device not found". So I thought I could test libusb with Xcode to see what USB devices are recognised.

I am using sample code from Introduction To Using LibUSB-1.0

Xcode project settings are:

  • OS X -> Application -> Command Line Tool
  • C++

When trying to compile, Xcode complains:

/.../libusb-Test/libusb-Test/main.cpp:2:10: 'libusb.h' file not found

I tried several things to fix the issue:

  1. Adding "/opt/local/include" to: Preferences -> Locations
  2. Adding "/opt/local/include/libusb-1.0" to: Preferences -> Locations
  3. Adding "/opt/local/include/libusb-1.0" to: Build Settings -> Library Search Path

IMAGE: Xcode, Build Settings

The only thing that seems to work is:

#include </opt/local/include/libusb-1.0/libusb.h>

But that doesn't seem to be the proper way of doing it.


Solution

  • I recommend you verify that the "Always Search User Paths" Build Setting is set to YES. Then you might add a User Header Search Path that includes the directory holding your reference.

    paths