I am currently working on a metal kernel (in a .metal file) for an image processing application in iOS. I wanted to include some standard C++ libraries (such as <iostream>
or <algorithm>
), but Xcode doesn't seem to allow it (I get a "file not found" error at compile time.
Has anybody ran into this sort of problem before? It seems ridiculous to have the ability to write custom kernels in metal without using some basic libraries, which makes me think that there must be an answer.
Let's see what the documentation says:
The C++ standard library must not be used in the Metal shading language code. Instead of using the C++ standard library, Metal uses its own standard library, which is described in Metal Standard Library.
So no, it's not possible. Use the metal standard library instead.