wxWebView::New and undefined reference to wxAutomationObject Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
szmitek
Earned a small fee
Earned a small fee
Posts: 12
Joined: Mon Nov 26, 2012 12:44 am
Location: Chotomów, Poland
Contact:

wxWebView::New and undefined reference to wxAutomationObject

Post by szmitek » Mon Dec 01, 2014 12:23 am

I have problem with compiling project with creating wxWebView object (wxWebView::New). I receive errors "undefined reference" to methods of wxAutomationObject. My header file:

Code: Select all

(...)
#include <wx/spinctrl.h>
#include <wx/grid.h>
#include <wx/xrc/xmlres.h>
#include <wx/numformatter.h>
#include <wx/dataview.h>
#include <wx/webview.h>
(...)
class PlayerWindow: public wxFrame
{
    private:
(...)
wxWebView *Balance;
(...)
};
My CPP file with use of wxWebView::New:

Code: Select all

#include "wx_pch.h"
#include "PlayerWindow.h"
#include "View.h"
#ifndef WX_PRECOMP
//(*InternalHeadersPCH(StartWindow)
//*)
#endif
//(*InternalHeaders(StartWindow)
//#include <wx/xrc/xmlres.h>
//*)
(...)
void PlayerWindow::Construct()
{
(...)
    Balance = wxWebView::New(this, wxID_ANY);
    resource->AttachUnknownControl(_T("Balance"), Balance);

    SetIcon(wxICON(aaaa));
}
(...)
Errors in debug mode:

Code: Select all

||=== Build: Debug in Business (compiler: MinGW TDM) ===|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview.o)||In function `ZN11wxWebViewIEC1Ev':|
C:\wxWidgets-3.0.2\build\msw\..\..\include\wx\msw\webview_ie.h|42|undefined reference to `wxAutomationObject::wxAutomationObject(void*)'|
C:\wxWidgets-3.0.2\build\msw\..\..\include\wx\msw\webview_ie.h|42|undefined reference to `wxAutomationObject::~wxAutomationObject()'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview.o)||In function `ZN11wxWebViewIEC1EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_':|
C:\wxWidgets-3.0.2\build\msw\..\..\include\wx\msw\webview_ie.h|51|undefined reference to `wxAutomationObject::wxAutomationObject(void*)'|
C:\wxWidgets-3.0.2\build\msw\..\..\include\wx\msw\webview_ie.h|51|undefined reference to `wxAutomationObject::~wxAutomationObject()'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN11wxWebViewIED2Ev':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|112|undefined reference to `wxAutomationObject::~wxAutomationObject()'|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|112|undefined reference to `wxAutomationObject::~wxAutomationObject()'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN11wxWebViewIE7LoadURLERK8wxString':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|141|undefined reference to `wxAutomationObject::CallMethod(wxString const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&)'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN11wxWebViewIE4StopEv':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|486|undefined reference to `wxAutomationObject::CallMethod(wxString const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&)'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN11wxWebViewIE13IsOfflineModeEv':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|525|undefined reference to `wxAutomationObject::GetProperty(wxString const&, int, wxVariant*) const'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN11wxWebViewIE14SetOfflineModeEb':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|541|undefined reference to `wxAutomationObject::PutProperty(wxString const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&, wxVariant const&)'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZNK11wxWebViewIE6IsBusyEv':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|549|undefined reference to `wxAutomationObject::GetProperty(wxString const&, int, wxVariant*) const'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZNK11wxWebViewIE13GetCurrentURLEv':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|558|undefined reference to `wxAutomationObject::GetProperty(wxString const&, int, wxVariant*) const'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN11wxWebViewIE14onActiveXEventER14wxActiveXEvent':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1210|undefined reference to `wxActiveXEvent::operator[](unsigned int)'|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1211|undefined reference to `wxActiveXEvent::operator[](unsigned int)'|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1245|undefined reference to `wxActiveXEvent::operator[](unsigned int)'|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1270|undefined reference to `wxActiveXEvent::operator[](unsigned int)'|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1313|undefined reference to `wxActiveXEvent::operator[](unsigned int)'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o):C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1326|more undefined references to `wxActiveXEvent::operator[](unsigned int)' follow|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN13wxIEContainerC2EP8wxWindowRK5_GUIDP8IUnknownP16DocHostUIHandler':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1516|undefined reference to `wxActiveXContainer::wxActiveXContainer(wxWindow*, _GUID const&, IUnknown*)'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `ZN13wxIEContainerD2Ev':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|1521|undefined reference to `wxActiveXContainer::~wxActiveXContainer()'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o)||In function `_static_initialization_and_destruction_0':|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|63|undefined reference to `wxEVT_ACTIVEX'|
C:\wxWidgets-3.0.2\build\msw\..\..\src\msw\webview_ie.cpp|63|undefined reference to `wxEVT_ACTIVEX'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30ud_webview.a(webviewlib_webview_ie.o):webview_ie.cpp:(.rdata$_ZTV13wxIEContainer[__ZTV13wxIEContainer]+0x334)||undefined reference to `wxActiveXContainer::MSWTranslateMessage(tagMSG*)'|
||=== Build failed: 23 error(s), 0 warning(s) (4 minute(s), 29 second(s)) ===|
Debug app compilation:

Code: Select all

[ 50,0%] mingw32-g++.exe -std=c++11 -g -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswud -IC:\wxWidgets-3.0.2\include -c "C:\Users\Kamil Szmit\Documents\Business\PlayerWindow.cpp" -o obj\Debug\PlayerWindow.o
[100,0%] mingw32-g++.exe -LC:\wxWidgets-3.0.2\lib\gcc_lib -o bin\Debug\Business.exe obj\Debug\Company.o obj\Debug\Controller.o obj\Debug\LinesTable.o obj\Debug\Model.o obj\Debug\ObserverWindow.o obj\Debug\PlayerWindow.o obj\Debug\Startup.o obj\Debug\StartWindow.o obj\Debug\TwoColumnsModel.o obj\Debug\TwoColumnsModelItem.o obj\Debug\View.o  obj\Debug\resource.res -mthreads  -lwxmsw30ud_richtext -lwxmsw30ud_aui -lwxmsw30ud_media -lwxmsw30ud_gl -lwxmsw30ud_xrc -lwxmsw30ud_html -lwxmsw30ud_adv -lwxmsw30ud_core -lwxbase30ud -lwxbase30ud_net -lwxbase30ud_xml -lwxmsw30ud_propgrid -lwxmsw30ud_ribbon -lwxmsw30ud_stc -lwxmsw30ud_webview -lwxexpatd -lwxpngd -lwxjpegd -lwxregexud -lwxscintillad -lwxtiffd -lwxzlibd -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
Errors in release mode:

Code: Select all

C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30u_webview.a(webviewlib_webview.o):webview.cpp:(.text$_ZN18wxWebViewFactoryIE6CreateEv[__ZN18wxWebViewFactoryIE6CreateEv]+0x113)||undefined reference to `wxAutomationObject::wxAutomationObject(void*)'|
C:\wxWidgets-3.0.2\lib\gcc_lib\libwxmsw30u_webview.a(webviewlib_webview.o):webview.cpp:(.text$_ZN18wxWebViewFactoryIE6CreateEv[__ZN18wxWebViewFactoryIE6CreateEv]+0x25f)||undefined reference to `wxAutomationObject::~wxAutomationObject()'|
Release app compilation:

Code: Select all

[ 42,9%] mingw32-g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DWX_PRECOMP -O2 -std=c++11 -IC:\wxWidgets-3.0.2\include -IC:\wxWidgets-3.0.2\lib\gcc_lib\mswu -IC:\wxWidgets-3.0.2\include -c "C:\Users\Kamil Szmit\Documents\Business\PlayerWindow.cpp" -o obj\Release\PlayerWindow.o
[100,0%] mingw32-g++.exe -LC:\wxWidgets-3.0.2\lib\gcc_lib -o bin\Release\Business.exe obj\Release\Company.o obj\Release\Controller.o obj\Release\LinesTable.o obj\Release\Model.o obj\Release\ObserverWindow.o obj\Release\PlayerWindow.o obj\Release\Startup.o obj\Release\StartWindow.o obj\Release\TwoColumnsModel.o obj\Release\TwoColumnsModelItem.o obj\Release\View.o  obj\Release\resource.res -s -mthreads  -lwxmsw30u_richtext -lwxmsw30u_aui -lwxmsw30u_media -lwxmsw30u_gl -lwxmsw30u_xrc -lwxmsw30u_html -lwxmsw30u_adv -lwxmsw30u_core -lwxbase30u -lwxbase30u_net -lwxbase30u_xml -lwxpng -lwxjpeg -lwxtiff -lwxzlib -lwxregexu -lwxexpat -lwxmsw30u_propgrid -lwxmsw30u_ribbon -lwxmsw30u_stc -lwxmsw30u_webview -lwxscintilla -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
I compile my program in Code::Blocks 13.12 in Windows 8.1 (IE11) using latest standalone 32bit TDM-GCC 4.8.1 compiler and wxWidgets 3.0.2. I have compiled wxWidgets myself with 32bit TDM-GCC 4.8.1 using commands:

Code: Select all

mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release
mingw32-make -f makefile.gcc SHARED=0 UNICODE=1 BUILD=debug
CodeBlocks show that wxUSE_WEBVIEW and wxUSE_WEBVIEW_IE are set to 1.

How to resolve this problem with undefined reference to wxAutomationObject methods? How to create wxWebView object and compile program? What should I change? Could you help me?
Kamil Szmit

User avatar
doublemax
Moderator
Moderator
Posts: 15170
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView::New and undefined reference to wxAutomationOb

Post by doublemax » Mon Dec 01, 2014 12:35 am

I don't use MingW, so i'm not 100% sure about this:

Try changing the order of the libraries, so that wxmsw30ud_webview comes before wxmsw30ud_core (which is the one that contains wxAutomationObject)
Use the source, Luke!

faradayent
Earned a small fee
Earned a small fee
Posts: 19
Joined: Sat Dec 12, 2009 3:13 am

Re: wxWebView::New and undefined reference to wxAutomationObject

Post by faradayent » Sat May 16, 2020 7:12 pm

Changing the order worked for me. Thanks!

Post Reply