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

Replies

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++