Closed Wlodzimierz-ABX-Skiba closed 2 weeks ago
Sorry, no, this can't be right, wxHAS_NATIVE_WINDOW
is defined in include/wx/nativewin.h
, so if we don't include the latter before testing for the former, it's never going to be defined.
What is the actual problem with including it with wxUniv?
Sorry, my bad to not investigate it deeply. The problem is during linking od the sample
g++ -o gcc_mswunivud\widgets.exe @gcc_mswunivud\widgets.exe.rsp -g -mthreads -L.\..\..\lib\gcc_lib -Wl,--subsystem,windows -mwindows -lwxmswuniv33ud_core -lwxbase33ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lgdiplus -lmsimg32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
gcc_mswunivud/widgets_native.o: In function `ZN14wxNativeWindowC2Ev':
C:\wxWidgets-master\samples\widgets/./../../include/wx/nativewin.h:71: undefined reference to `vtable for wxNativeWindow'
gcc_mswunivud/widgets_native.o: In function `ZN14wxNativeWindow6DisownEv':
C:\wxWidgets-master\samples\widgets/./../../include/wx/nativewin.h:103: undefined reference to `wxNativeWindow::DoDisown()'
gcc_mswunivud/widgets_native.o: In function `ZN12NativeWindowC1EP8wxWindow':
C:\wxWidgets-master\samples\widgets/native.cpp:106: undefined reference to `wxNativeWindow::Create(wxWindow*, int, HWND__*)'
C:\wxWidgets-master\samples\widgets/native.cpp:85: undefined reference to `wxNativeWindow::~wxNativeWindow()'
gcc_mswunivud/widgets_native.o: In function `ZN12NativeWindowD1Ev':
C:\wxWidgets-master\samples\widgets/native.cpp:110: undefined reference to `wxNativeWindow::~wxNativeWindow()'
collect2.exe: error: ld returned 1 exit status
I think the simplest fix should be to do this:
diff --git a/include/wx/nativewin.h b/include/wx/nativewin.h
index 6f3e631cec..cd428606c4 100644
--- a/include/wx/nativewin.h
+++ b/include/wx/nativewin.h
@@ -31,7 +31,7 @@
// all platforms except GTK where we also can work with Window/XID)
//
// - wxNativeWindowHandle for child windows, i.e. HWND/GtkWidget*/NSControl
-#if defined(__WXMSW__)
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/wrapwin.h"
typedef HWND wxNativeContainerWindowId;
Actually it would make sense to provide wxNativeWindow
in wxUniv, but this would require more changes.
Yes, @vadz change in header is better. Tested and it builds now fine.
OK, this looks good now, thanks.
I suppose wxHAS_NATIVE_WINDOW should be guarded inside of wx/nativewin.h however this file is shared by the ports I'm unable to test so I prefer to stay on safe side and only move check inside of sample. Without this change widgets sample fail to build under wxUniv