Undefined reference to wxHtmlWindowMouseHelper 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
gismo
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Mar 12, 2020 10:48 pm

Undefined reference to wxHtmlWindowMouseHelper

Post by gismo » Sun May 10, 2020 4:30 pm

I'm working on Windows 10 on a GUI project in C::B 17.12 using wxWIdgets 3.1.3, Shared=0 unicode=1 When I add and HtmlWindow and compile I get 2 errors:

Undefined reference to wxHtmlWindowMouseHelper::wxHtmlWindowMouseHelper(wxHtmlWindowInterface)

Undefined refernce to vtable for wxHtmlWindow

It compiles fine without the HtmlWindow

any help would be appreciated.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by stahta01 » Sun May 10, 2020 6:36 pm

Did you link to the correct library?
What compiler are you using?
NOTE: Code::Blocks is not a compiler!

Post the linker error with the linker command from the build log window.

Tim S.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2469
Joined: Sun Jan 03, 2010 5:45 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by PB » Sun May 10, 2020 6:43 pm

Sorry for the stupid question, but: Did you add (and in the correct order) the wxHTML library, i.e. libwxmsw31u_html.a for the Release and libwxmsw31ud_html.a for the Debug build configurations in Code::Blocks' Project Build Options in Linker Settings / Link Libraries?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4240
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by ONEEYEMAN » Sun May 10, 2020 7:05 pm

Hi,
You should add the appropriate library to the "Linker" options.

But I am curious - why do you need to use an undocumented class in your program?

Thank you.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by stahta01 » Sun May 10, 2020 8:12 pm

ONEEYEMAN wrote:
Sun May 10, 2020 7:05 pm
But I am curious - why do you need to use an undocumented class in your program?
He likely did not; that wxHtmlWindowMouseHelper class is a helper class that is needed
to use the documented class of wxHtmlWindow.

From wx/htmlwin.h

Code: Select all

wxHtmlWindow() : wxHtmlWindowMouseHelper(this) { Init(); }
Tim S.

gismo
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Mar 12, 2020 10:48 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by gismo » Mon May 11, 2020 2:31 am

Thanks for all of your responses. These are the libraries I linked in the order they are linked
liboleacc.a
libuxtheme.a
libwxmsw31u_html.a

here's my build log

Code: Select all

-------------- Build: Release in Acorn (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -IC:\wxWidgets-3.1.3\include -IC:\wxWidgets-3.1.3\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.3\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.3\include -c I:\Acorn\AcornApp.cpp -o I:\Acorn\obj\release\AcornApp.o
mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -O2 -IC:\wxWidgets-3.1.3\include -IC:\wxWidgets-3.1.3\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.3\lib\gcc_lib\mswu -IC:\wxWidgets-3.1.3\include -c I:\Acorn\AcornMain.cpp -o I:\Acorn\obj\release\AcornMain.o
mingw32-g++.exe -LC:\wxWidgets-3.1.3\lib\gcc_lib -o I:\Acorn\bin\release\Acorn.exe I:\Acorn\obj\release\AcornApp.o I:\Acorn\obj\release\AcornMain.o I:\Acorn\obj\release\convertDBHtoStump.o I:\Acorn\obj\release\csv.o I:\Acorn\obj\release\CSVexport.o I:\Acorn\obj\release\height5.o I:\Acorn\obj\release\main.o I:\Acorn\obj\release\openfile.o I:\Acorn\obj\release\probsurv5.o I:\Acorn\obj\release\readadrepnewformat.o I:\Acorn\obj\release\readstumpnewformat.o I:\Acorn\obj\release\reproDBH10.o I:\Acorn\obj\release\reproDBH21.o I:\Acorn\obj\release\stumpDBH10.o I:\Acorn\obj\release\stumpDBH21.o  I:\Acorn\obj\release\icon.res I:\Acorn\obj\release\resource.res -s -mthreads  -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -lwxjpeg -lwxtiff -loleacc -luxtheme -lwxmsw31u_html -mwindows
I:\Acorn\AcornApp.cpp: In member function 'virtual bool AcornApp::OnInit()':
I:\Acorn\AcornApp.cpp:32:21: warning: unused variable 'splash' [-Wunused-variable]
     wxSplashScreen* splash = new wxSplashScreen(bitmap,
                     ^
C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_html.a(htmllib_htmlwin.o):htmlwin.cpp:(.text+0x2be4): undefined reference to `wxFileSystem::FileNameToURL(wxFileName const&)'
C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_html.a(htmllib_htmlwin.o):htmlwin.cpp:(.text+0x32cb): undefined reference to `wxFileSystem::ChangePathTo(wxString const&, bool)'
C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_html.a(htmllib_htmlwin.o):htmlwin.cpp:(.text+0x3e0b): undefined reference to `wxFileSystem::FileNameToURL(wxFileName const&)'
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_html.a(htmllib_htmlwin.o): bad reloc address 0x30c in section `.rdata'
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 10 second(s))
4 error(s), 1 warning(s) (0 minute(s), 10 second(s))
This has been driving me nuts so I appreciate any help. Thanks

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2469
Joined: Sun Jan 03, 2010 5:45 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by PB » Mon May 11, 2020 7:07 am

gismo wrote:
Mon May 11, 2020 2:31 am
here's my build log

Code: Select all

-------------- Build: Release in Acorn (compiler: GNU GCC Compiler)---------------
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_html.a(htmllib_htmlwin.o): bad reloc address 0x30c in section `.rdata'
Well, it seems your wxHTML library is invalid?

I would also move the HTML library before core one, i.e., the order of wxWidgets libraries would be: html, core, base, others

gismo
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Mar 12, 2020 10:48 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by gismo » Mon May 11, 2020 11:01 am

PB thanks for your reply. Yeah I thought originally that it might be the library order so I tried putting it in all possible orders and none worked.
I did successfully compile and run the sample wxHtmlEasyPrinting code with no issues in the order I have listed so I thought the library was fine.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4240
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by ONEEYEMAN » Mon May 11, 2020 2:45 pm

Hi
So can you look at the command that the sample build produces and do the same here in your project?

Thank you.

gismo
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Mar 12, 2020 10:48 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by gismo » Mon May 11, 2020 9:34 pm

So I did what ONEEYEMAN suggested. Here's how I compiled:

Code: Select all

mingw32-g++.exe -LC:\wxWidgets-3.1.3\lib\gcc_lib -o I:\Acorn\bin\release\Acorn.exe I:\Acorn\obj\release\AcornApp.o I:\Acorn\obj\release\AcornMain.o I:\Acorn\obj\release\convertDBHtoStump.o I:\Acorn\obj\release\csv.o I:\Acorn\obj\release\CSVexport.o I:\Acorn\obj\release\height5.o I:\Acorn\obj\release\main.o I:\Acorn\obj\release\openfile.o I:\Acorn\obj\release\probsurv5.o I:\Acorn\obj\release\readadrepnewformat.o I:\Acorn\obj\release\readstumpnewformat.o I:\Acorn\obj\release\reproDBH10.o I:\Acorn\obj\release\reproDBH21.o I:\Acorn\obj\release\stumpDBH10.o I:\Acorn\obj\release\stumpDBH21.o  I:\Acorn\obj\release\icon.res I:\Acorn\obj\release\resource.res -s -mthreads  -lwxmsw31u_html -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -lshlwapi -lversion -lwxmsw31u_html -loleacc -luxtheme -lwxjpeg
And this is the error I got

Code: Select all

C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_core.a(corelib_imagtiff.o): bad reloc address 0xac in section `.rdata'
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xadb): undefined reference to `TIFFSetWarningHandler'
C:\wxWidgets-3.1.3\lib\gcc_lib/libwxmsw31u_core.a(corelib_imagtiff.o):imagtiff.cpp:(.text+0xae7): undefined reference to `TIFFSetErrorHandler'

gismo
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Mar 12, 2020 10:48 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by gismo » Mon May 11, 2020 9:43 pm

disregard my previous reply I ned to recompile

gismo
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Mar 12, 2020 10:48 pm

Re: Undefined reference to wxHtmlWindowMouseHelper

Post by gismo » Mon May 11, 2020 10:00 pm

Ok so I compiles with the above code and added -lwxtiff -mwindows at the end and it ran.

Thanks for all your help

Post Reply