I'm trying to get libusb set up in an empty CLI Xcode project. I installed it with brew install libusb, and set the "Library Search Path" to:
$(PROJECT_DIR)/**
/usr/local/lib/**
/usr/local/Cellar/libusb/1.0.27/lib
And the "System Header Search Path" to /usr/local/include/**, created a basic bridging header and added it to the build settings:
#include <libusb-1.0/libusb.h>
I also added libusb-1.0.0.dylib to "Frameworks and Libraries".
But for some reason, Xcode throws tons of errors related to random system headers while trying to compile the project:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/copyfile.h:42:9: unknown type name 'uint32_t'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/copyfile.h:63:44: unknown type name 'uint32_t'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/copyfile.h:64:44: unknown type name 'uint32_t'
/usr/local/include/c++/13/bits/cpp_type_traits.h:67:8: expected identifier or '('
/usr/local/include/c++/13/ext/type_traits.h:37:8: expected identifier or '('
/usr/local/include/c++/13/cstdlib:125:8: expected identifier or '('
/usr/local/include/c++/13/tr1/cstdlib:42:1: unknown type name 'namespace'
/usr/local/include/c++/13/tr1/cstdlib:42:43: expected ';' after top level declarator
/usr/local/include/c++/13/tr1/stdlib.h:41:1: unknown type name 'using'
/usr/local/include/c++/13/tr1/stdlib.h:41:10: expected ';' after top level declarator
/usr/local/include/c++/13/tr1/stdlib.h:41:11: expected identifier or '('
/usr/local/include/c++/13/tr1/stdlib.h:42:1: unknown type name 'using'
/usr/local/include/c++/13/tr1/stdlib.h:42:10: expected ';' after top level declarator
/usr/local/include/c++/13/tr1/stdlib.h:42:11: expected identifier or '('
/usr/local/include/c++/13/tr1/stdlib.h:44:1: unknown type name 'using'
/usr/local/include/c++/13/tr1/stdlib.h:44:10: expected ';' after top level declarator
/usr/local/include/c++/13/tr1/stdlib.h:44:11: expected identifier or '('
/usr/local/include/c++/13/tr1/stdlib.h:46:1: unknown type name 'using'
/usr/local/include/c++/13/tr1/stdlib.h:46:10: expected ';' after top level declarator
too many errors emitted, stopping now
I looked at the lines in some of these headers with errors, and they seem fine:
typedef uint32_t copyfile_flags_t; // <- unknown type name 'uint32_t'
using std::tr1::atoll; // expected ';' after top level declarator, expected identifier or '(', unknown type name 'using'
using std::tr1::strtoll; // expected ';' after top level declarator, expected identifier or '(', unknown type name 'using'
using std::tr1::strtoull; // expected ';' after top level declarator, expected identifier or '(', unknown type name 'using'
using std::tr1::abs; // expected ';' after top level declarator, unknown type name 'using'
extern "C++" { // expected identifier or '('
I also tried cleaning the build folder and restarting Xcode.