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
Describe the bug
This is technically not a bug but when trying to integrate rerun C++ API into a pretty big C/C++ codebase (with third-party dependencies) the compilation fails because some file already defined "DEBUG" as a macro. While a questionable choice, it's unfortunately pretty common in C code. The compilation fails at
Good catch. DEBUG as name is an identifier is very unfortunate indeed, we'll have to put something else in there.
DBG and _DBG are defines I've seen in the past as well, so we'll have to do something else, probably some post/prefix 🤔
Adding #undef DEBUG implies #include <rerun.h> would un-define DEBUG. That means it may break user code that relies on that macro may break.
Other variations of DEBUG such as DEBUG_DBG etc are also likely to be macros.
An alternative solution is to use PascalCase for constants instead, as those are much less likely to be macros, i.e. change this to static const TextLogLevel Debug; and TextLogLevel::Debug.
Another benefit of the PascalCase convention is that it is closer to Rust.
Describe the bug
This is technically not a bug but when trying to integrate rerun C++ API into a pretty big C/C++ codebase (with third-party dependencies) the compilation fails because some file already defined "DEBUG" as a macro. While a questionable choice, it's unfortunately pretty common in C code. The compilation fails at
rerun/rerun_cpp/src/rerun/components/text_log_level.hpp
Line 54 in 1f58d96
with an error like:
One quick and dirty way to fix or at least to confirm this, is something like this is in the same header:
Another common solution is to not use "DEBUG" and instead DBG, _DBG, etc
Desktop:
Rerun version
0.10
Additional context
The text was updated successfully, but these errors were encountered: