I'm having trouble getting xcode to find a particular header file, namely cstring
.
My project compiled properly until I added a new library. The library, oscpack, consists of .h and .cpp files. I copied these into my project. Some of these files include cstring
. Now when I try to compile I get this error:
Lexical or Preprocessor Issue
(...)/xcode4/osc/OscOutboundPacketStream.h:40:10: 'cstring' file not found
I'm new to C++ and I'm still a bit mystified regarding header file locations. Does anyone know where to find cstring
on my system, and how I should tell xcode to look for it there?
EDIT
I ran sudo find . -name "*cstring*"
and located the header file. It's here:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/cstring
Now how do I tell XCode to search there?
EDIT 2
I tried adding $(SDKROOT)/usr/include/c++/4.2.1
to my Header Search Paths. I entered a world of pain. Dozens of compiler errors were thrown, starting with these.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/bits/c++config.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/bits/c++config.h:153:1: Unknown type name 'namespace'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/bits/c++config.h:153:1: Expected ';' after top level declarator
<cstring>
is a C++ header. Is the problem that you're building the file that includes it as C or Objective-C and not as C++ or Objective-C++?
oscpack describes itself as a C++ library, so you'll need to be using C++ anywhere you include its headers.