in our project we ran into a problem considering the include of the standard library memory. #include <memory>
in an Objective-C headerfile causes the error 'memory' file not found
. The header file is imported for an external static library and it was already working once when we checked out a previous version of the library.
With this previous version the same error occurs now and since then the only change we made on this test project for the library is the update of XCode to version 9.2 from previously 8.3.
Did anyone encounter a similar issue when using an external library and updating XCode or might drop me a hint, what could be cause for this behaviour?
memory
is a C++-only header. You can only include it to C++ and Objective-C++ files. You should change the file suffix from .m
to .mm
to change a Objective-C file to an Objective-C++ file.
If you want put the include into an Objective-C header and include it into Objective-C and Objective-C++ code as well, you should enclose the include with appropriate #ifdef
, e.g.:
#ifdef __cplusplus
#include <memory>
#endif
Note: You can still only use the declarations from <memory>
in (Objective-)C++.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With