Undefined reference to ms_wxDummy with RTTI disabled (Issue #26389)

29 views
Skip to first unread message

Steve Cornett

unread,
Apr 16, 2026, 8:31:09 PM (7 days ago) Apr 16
to wx-...@googlegroups.com, Subscribed
stevecor created an issue (wxWidgets/wxWidgets#26389)

Building wxWidgets with RTTI disabled results in compiler or linker errors due to 'ms_wxDummy' not defined.

Repro on Windows with Visual Studio 2026:

  1. Fresh clone
  2. Load wx_vc18.slnx
  3. Select all projects in the solution
  4. Use menu command Project Properties
  5. Navigate to C/C++: Language and set "Enable Run-Time Type Information" to "No (/GR-)"
  6. Build.

The build ends with this error:

C:\project\wxWidgets\include\wx\event.h(571,5): error C7631: 'ms_wxDummy': variable with internal linkage declared but not defined

Repro on Linux with GCC 15.2:

  1. Fresh clone
  2. configure --enable-no_rtti --disable-stc && make

The build ends with these errors:

wxrc.cpp:(.text._ZN20wxObjectEventFunctor14ms_wxClassInfoEv[_ZN20wxObjectEventFunctor14ms_wxClassInfoEv]+0x2): undefined reference to `wxObjectEventFunctor::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<wxObject*>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<bool>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImplConstCharPtr::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImplConstWchar_tPtr::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<wxDateTime>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImplwxString::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<wxArrayString>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<wxAnyNullValue>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImplInt::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImplDouble::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<wxUniChar>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImplVariantData::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<void*>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<wxAnyList>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImpl<wxVariant>::ms_wxDummy'
/usr/bin/ld: /home/test/bug/wxWidgets/lib/libwx_baseu-3.3.so: undefined reference to `wxAnyValueTypeImplUint::ms_wxDummy'

The culprit is the macro definition below in include/wx/typeinfo.h. A static member named ms_wxDummy is declared, but never defined.

// Use this macro to declare type info fully inline in class.
#define WX_DECLARE_TYPEINFO_INLINE(CLS) \
private: \
    static char ms_wxDummy; \
    static void ms_wxClassInfo() { ms_wxDummy = 0; } \
_WX_DECLARE_TYPEINFO_CUSTOM(CLS, ms_wxClassInfo)

I do not see the purpose of ms_wxDummy. I propose removing it with the change below. With this change, I see no build errors.

diff --git a/include/wx/typeinfo.h b/include/wx/typeinfo.h
index 4b54b94157..25134b349f 100644
--- a/include/wx/typeinfo.h
+++ b/include/wx/typeinfo.h
@@ -129,8 +129,7 @@ void CLS::ms_wxClassInfo() { ms_wxDummy = 0; }
 // Use this macro to declare type info fully inline in class.
 #define WX_DECLARE_TYPEINFO_INLINE(CLS) \
 private: \
-    static char ms_wxDummy; \
-    static void ms_wxClassInfo() { ms_wxDummy = 0; } \
+    static void ms_wxClassInfo() { } \
 _WX_DECLARE_TYPEINFO_CUSTOM(CLS, ms_wxClassInfo)

 #define wxTypeId(OBJ) (OBJ).GetWxTypeId()


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26389@github.com>

VZ

unread,
Apr 17, 2026, 11:55:57 AM (7 days ago) Apr 17
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26389)

This is usually done to force linking with the object file defining the variable and which could/would be otherwise omitted by the linker when using static linking, but I agree that this doesn't make much sense for an "inline" version of the macro, so I guess we should apply this. If you can, please check if this still works with static linking too. TIA!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26389/4269483783@github.com>

Steve Cornett

unread,
Apr 17, 2026, 1:10:01 PM (7 days ago) Apr 17
to wx-...@googlegroups.com, Subscribed
stevecor left a comment (wxWidgets/wxWidgets#26389)

I tested both static and dynamic on Windows and Linux, both building as well as running. I was not able to build on macOS with --enable-no_rtti due to dynamic_cast that are not guarded. So I tested with clang on Linux. Saw no problems.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26389/4269901569@github.com>

VZ

unread,
Apr 18, 2026, 9:23:58 AM (6 days ago) Apr 18
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26389)

Thanks for testing, will push this soon.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26389/4273749731@github.com>

VZ

unread,
Apr 18, 2026, 6:28:03 PM (6 days ago) Apr 18
to wx-...@googlegroups.com, Subscribed

Closed #26389 as completed via 0932112.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/26389/issue_event/24643258130@github.com>

Reply all
Reply to author
Forward
0 new messages