问题
I'm trying to use a struct with an atomic_int
for use in a metal compute shader. However, it says I need to import #include "stdatomic.h"
- but every time I try, it can't find the file.
#include "stdatomic.h" // 'stdatomic.h' file not found
I'm trying to build my application for macOS Catalina
struct Fitness {
atomic_int weight; // Declaration of 'atomic_int' must be imported from module 'Darwin.C.stdatomic' before it is required
...others...
};
- I have tried placing a copy of
stdatomic.h
into my project, but that gives a lot of compilation errors. - My struct is defined in a
.h
header file. - The struct is used by both Swift & Metal.
- I'm using XCode 11.4.
Update: If I #include in a .cpp file it works...why not a header?
Any ideas what is wrong? Can I not do what I want?
来源:https://stackoverflow.com/questions/61001742/stdatomic-h-not-found-for-use-in-swift-metal-compute-shader