ConfettiFX / The-Forge

The Forge Cross-Platform Rendering Framework PC Windows, Steamdeck (native), Ray Tracing, macOS / iOS, Android, XBOX, PS4, PS5, Switch, Quest 2
Apache License 2.0
4.65k stars 491 forks source link

Compile time error with conflict between '#define delete' and C++11 Mutex copy-constructor deletion ('= delete;') #210

Closed vlmillet closed 2 years ago

vlmillet commented 2 years ago

There is a strange #define delete in IMemory.h which, when included before IThread.h enters in collision with MutexLock(const MutexLock& rhs) = delete; (C++11). Redefining delete is something that should be avoided IMHO to avoid this kind of difficult-to-track compilation failures : VS studio does not get you to the original #define and just prompt a static_assert.

manas-kulkarni commented 2 years ago

Yes. It is to discourage using the C/C++ memory allocation/deallocation functions directly and instead use the tf_ variants. If you notice, IMemory.h is always included last in all source files. That should fix the error. If for some reason you are forced to include IMemory.h in a header file, there is a macro you can set - IMEMORY_FROM_HEADER

wolfgangfengel commented 2 years ago

Usage as intended ...