XCode 10 - "new" file not found

Hello,


Just upgraded XCode to version 10. I tried to compile my project which use both Objective-C and C++ files.

One of the cpp files includes a header file (.h) which has the following line:

#include <new>


Compiler gives this error: 'new' file not found

Why is that? I didn't have this problem with XCode 9.


Thanks,

Kal

I would first do a clean build folder.


Also have a look here : https://forums.developer.apple.com/thread/106114

Hello Claude,


Just did clean build folder. Didn't help 😟


Thanks,

Kal

OK, so look at the advices in the link. They address a pretty similar problem.

I will, Thank you Claude!

I have exactly the same problem since upgrading to Xcode 10. The compiler cannot seem to find framework header files. I did not have this problem in Xcode 9. 'Header Search Paths' and 'User Header Search Paths' point to the correct folders. Additionally I have 'Use Header Maps' and 'Always Search User Paths (Deprecated) 'to 'Yes'. Switching them to No doesn't help. Also a clean build doesn't help.

Select the file xcode can't find and see the right column.You'll find “identity and type”->"Location" and select "Relative to project".

One way I was able to resolve this issue was to add the libc++.tbd in the Targets -> "Build Phases" -> "Link Binary with Libraries" and also set under the "Build Settings" -> "Apple Clang - Language - C++" -> "C++ Standard Library" to libc++

Thank you, @dingjianjaja! This saved me a ton of time and headache.

Add User-Defined Settings works for me (Xcode Version 13.3.1)

CLANG_CXX_LIBRARY : libc++

I had an identical issue using SDK 10.9 targeting x86_64 from macOS Sonoma on an M1 Mac.

What I found was that the SDK I was using didn't contain a MacOSX10.9.sdk/usr/include/c++/v1 folder, but instead contained a MacOSX10.9.sdk/usr/include/c++/4.2.1 folder.

The fix was to either explicitly include the 4.2.1 folder during build time or create a symbolic link v1 --> 4.2.1.

In my case, I was using cmake, so I added the include directory to my build.

XCode 10 - "new" file not found
 
 
Q