Compilation errors when trying to use wxWebView on Windows 10 Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

Compilation errors when trying to use wxWebView on Windows 10

Post by fishnet37222 »

I'm trying to use a wxWebView control to display the license for the program I'm writing. I'm getting the following compilation errors. I'm using wxWidgets 3.1.0 with Visual Studio 2017 on Windows 10.

Code: Select all

1>------ Build started: Project: FNDice, Configuration: Debug x64 ------
1>AboutDialog.cpp
1>AboutDialog.obj : error LNK2019: unresolved external symbol "public: static class wxWebView * __cdecl wxWebView::New(class wxString const &)" (?New@wxWebView@@SAPEAV1@AEBVwxString@@@Z) referenced in function "public: __cdecl AboutDialog::AboutDialog(class wxWindow *,int,class wxString const &)" (??0AboutDialog@@QEAA@PEAVwxWindow@@HAEBVwxString@@@Z)
1>AboutDialog.obj : error LNK2001: unresolved external symbol "char const * const wxWebViewNameStr" (?wxWebViewNameStr@@3QBDB)
1>AboutDialog.obj : error LNK2001: unresolved external symbol "char const * const wxWebViewDefaultURLStr" (?wxWebViewDefaultURLStr@@3QBDB)
1>AboutDialog.obj : error LNK2001: unresolved external symbol "char const * const wxWebViewBackendDefault" (?wxWebViewBackendDefault@@3QBDB)
1>vc_mswud_x64\FNDice.exe : fatal error LNK1120: 4 unresolved externals
1>Done building project "FNDice.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here is the code I used to create the wxWebView.

Code: Select all

auto wvLicense = wxWebView::New();
wvLicense->Create(tabLicense, wxID_ANY);
Dave F.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Compilation errors when trying to use wxWebView on Windows 10

Post by doublemax »

Did you add wxmsw31ud_webview.lib to the input libraries? (The library name could be slightly different based on your configurations, but you should get the idea).
Use the source, Luke!
fishnet37222
Experienced Solver
Experienced Solver
Posts: 74
Joined: Sat May 06, 2017 1:40 pm

Re: Compilation errors when trying to use wxWebView on Windows 10

Post by fishnet37222 »

I added the required library as an explicit linker input and it compiled without any errors, but I was expecting the linker to search all the libraries in the library directories.
Dave F.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Compilation errors when trying to use wxWebView on Windows 10

Post by PB »

fishnet37222 wrote: was expecting the linker to search all the libraries in the library directories.
That is not how a C++ linker works.

Anyway, you are using MSVC so you can avoid listing required libraries by hand by including an MSVC only header file:
WXWIN/docs/msw/install.txt wrote: Microsoft Visual C++ users can simplify the linker setup by prepending
"$(WXWIN)\include\msvc" to the include path (it must come before the
"$(WXWIN)\include" part!) and omitting the last step: the required libraries
will be linked in automatically using the "#pragma comment(lib)" feature of
this compiler.
Post Reply