You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My project is heavily using C++20 modules. I'm compiling using VS 2022, with the /translateIncludes option enabled (for compability with some other libraries - this option automatically turns every include of a header into an import of a header unity).
However, header units don't work well with static declarations, because a header unit is a translation unit on its own, and static functions are only defined within the same translation unit, so the consumer of the header can't use the functions that were declared as static.
This results in this build error: error C2129: static function 'bool has_callstack(void) noexcept' declared but not defined when I build my project while including Tracy.hpp and using ``TracyAlloc/TracyFree to markup my memory allocations.
The affected functions are (as far as I've found, maybe there are others that I just don't use yet)
bool has_callstack()
void* Callstack( int32_t depth )
void* tracy_malloc( size_t size )
void* tracy_malloc_fast( size_t size )
void tracy_free( void* ptr )
void tracy_free_fast( void* ptr )
void* tracy_realloc( void* ptr, size_t size )
removing the static from the declaration (but keeping the inline or constexpr, so the linker can deduplicate the symbols) fixes the issue.
The text was updated successfully, but these errors were encountered:
Same issue with a simple FrameMarkerStart that reports an error for tracy_free_fast.
Also using modules with VS 2022
Added tracy using vcpkg + cmake
Edit: Seems this is a general bug with MSVC (@Bizzarrus) having issues with "static inline" definitions in header files that are imported into modules. I don't think there's that much the tracy authors could really do without breaking performance of the lib :( I myself am currently looking into switching to clang in hopes it doesn't have the same issues ...
Edit 2: I don't (yet) know enough about this stuff to judge this, but I've found this: dcleblanc/SafeInt#61
Seems to be about the same issue, and there they see no issue to making the definitions just inline instead of static inline. Maybe the tracy author(s) can have a look at that.
My project is heavily using C++20 modules. I'm compiling using VS 2022, with the /translateIncludes option enabled (for compability with some other libraries - this option automatically turns every include of a header into an import of a header unity).
However, header units don't work well with
static
declarations, because a header unit is a translation unit on its own, and static functions are only defined within the same translation unit, so the consumer of the header can't use the functions that were declared as static.This results in this build error:
error C2129: static function 'bool has_callstack(void) noexcept' declared but not defined
when I build my project while includingTracy.hpp
and using ``TracyAlloc/TracyFree
to markup my memory allocations.The affected functions are (as far as I've found, maybe there are others that I just don't use yet)
removing the
static
from the declaration (but keeping theinline
orconstexpr
, so the linker can deduplicate the symbols) fixes the issue.The text was updated successfully, but these errors were encountered: