Can't link metal-cpp to Modern Rendering With Metal sample

There is a sample project from Apple here. It has a scene of a city at night and you can move in it. It basically has 2 parts:

  1. application code written in what looks like Objective-C (I am more familiar with C++), which inherits from things like NSObject<NSApplicationDelegate>, MTKView, NSViewController<MTKViewDelegate> and so on - it processes input and all app-related and window-related stuff.
  2. rendering code that also looks like Objective-C. Btw both parts are mostly in .mm files (Obj-C++ AFAIK). The application part directly uses only one class from the rendering part - AAPLRenderer.

I want to move the rendering part to C++ using metal-cpp. For that I need to link metal-cpp to the project. I did it successfully with blank projects several times before using this tutorial. But with this sample project Xcode can't find Foundation/Foundation.hpp (and other metal-cpp headers). The error says this: Did not find header 'Foundation.hpp' in framework 'Foundation' (loaded from '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks')

Pls help

Answered by gachapon in 806537022

Apparently there are 2 header search paths properties in the Xcode target settings - one for the whole project and one for Metal, and I somehow inserted the path to metal-cpp into Metal's property instead of for the whole project. Now it works.

Accepted Answer

Apparently there are 2 header search paths properties in the Xcode target settings - one for the whole project and one for Metal, and I somehow inserted the path to metal-cpp into Metal's property instead of for the whole project. Now it works.

Can't link metal-cpp to Modern Rendering With Metal sample
 
 
Q