wxWebView on trunk Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 488
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

wxWebView on trunk

Post by raananb »

Windows 10, Visual Studio Community 2017, trunk updated on 17:25 CET.

I have a link problem for which I have not found the reason. Here is the environment:

My application contains wxDialog object GetShareQuote with the function CheckShareQuote():

Code: Select all

#include "wx/webview.h"

#if defined(__WXOSX__) 
#include "wx/osx/webview_webkit.h"
#elif defined(__WXGTK__)
#include "wx/gtk/webview_webkit.h"
#elif defined(__WXMSW__)
#include "wx/msw/webview_ie.h"
#endif

GetShareQuote(wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos,  const wxSize& size, long style)
{
...
  bool CheckShareQuote(wxWindow* pWindow, wxArrayString* Titres, wxArrayString* CodesIsin, 
  wxArrayString*  Quotes, wxArrayString* QuoteDates, wxArrayDouble* DQuotes, wxString* ErrMessage);
}

// Constructor:
  GetShareQuote( wxWindow* parent, wxWindowID id = SYMBOL_GetShareQuote_IDNAME, 
                const wxString& caption = SYMBOL_GetShareQuote_TITLE, 
                const wxPoint& pos = SYMBOL_GetShareQuote_POSITION, 
                const wxSize& size = SYMBOL_GetShareQuote_SIZE, 
                long style = SYMBOL_GetShareQuote_STYLE
                );

CheckShareQuote() is called in different parts of the application after creating the dialog object (each time):

Code: Select all

GSQ = new GetShareQuote(this);
GSQ->CheckShareQuote(this, m_data.Titres, m_data.Isins, m_data.Quotes, m_data.QuoteDates, m_data.DQuotes, &errMessage);
CheckShareQuote() uses wxWebView to obtain information from a website using HTTPS. wxWebView was selected over a direct access to the website (curl, etc.) because it allows to extract the information very easily from the displayed page, with no navigation. Also, it is the only wxWidget object I found able to access HTTPS.

This architecture resolves the asynchronous behavior of wxWebView by the use of timers. It compiled and linked with no errors with an earlier trunk (25/11) and that version works as expected.

With today's trunk, I have a problem which I do not know how to solve:

CheckShareQuote() contains the expression (copied from the webview sample)

m_browser = wxWebView::New(pWindow, wxID_ANY, url);

(m_browser is wxWebView*, pWindow is wxWindow* of the caller, url is a const wxString)

This statement generates the link errors below. Strangely (for me) no errors are raised with sample of today's trunk.

All the errors are 'external symbol not resolved':

1>getsharequote.obj : error LNK2001: symbole externe non résolu "public: static class wxWebView * __cdecl wxWebView::New(class wxWindow *,int,class wxString const &,class wxPoint const &,class wxSize const &,class wxString const &,long,class wxString const &)" (?New@wxWebView@@SAPAV1@PAVwxWindow@@HABVwxString@@ABVwxPoint@@ABVwxSize@@1J1@Z)

1>getsharequote.obj : error LNK2001: symbole externe non résolu "char const * const wxWebViewBackendDefault" (?wxWebViewBackendDefault@@3QBDB)

1>getsharequote.obj : error LNK2001: symbole externe non résolu "char const * const wxWebViewNameStr" (?wxWebViewNameStr@@3QBDB)
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxWebView on trunk

Post by eranon »

Did you add the lib containing the wxWebView class to your linker options?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 488
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: wxWebView on trunk

Post by raananb »

The project includes D:\wxWidgets/lib/vc_lib among the additional linker libraries

This is where wxWidgets stores the wxmsw31u_webview.lib and wxmsw31ud_webview.lib
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxWebView on trunk

Post by eranon »

Yes, it's the search directory, but did you explicitely add it to the list of libs to link? Here is a screen capture from Visual C++ 2008 Express with the WebView sample project loaded.
Attachments
snap_0005204.png
snap_0005204.png (39.05 KiB) Viewed 1876 times
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 488
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: wxWebView on trunk

Post by raananb »

Thanks.

I changed the creation of the wxWebView object (see below), and added the libraries explicitly in the project properties, but this did not resolve the issue:

Code: Select all

getsharequote.obj : error LNK2001: symbole externe non résolu "public: static class wxWebView * __cdecl wxWebView::New(class wxWindow *,int,class wxString const &,class wxPoint const &,class wxSize const &,class wxString const &,long,class wxString const &)" (?New@wxWebView@@SAPAV1@PAVwxWindow@@HABVwxString@@ABVwxPoint@@ABVwxSize@@1J1@Z)
If anyone can decode the last line, this may help.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxWebView on trunk

Post by eranon »

This line simply says it cannot find the wxWebView::New function with this signature because you didn't link with the webview lib. Unless linker bug, there's certainly a mistake somewhere in your build options about path and/or lib file name. Do you succeed to build the webview sample with Visual Studio Community 2017?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 488
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: wxWebView on trunk

Post by raananb »

Turns out that DialogBlocks does not generate the links for webview libraries. Adding them manually solved the problem.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxWebView on trunk

Post by eranon »

It's exactly what I told you when I asked: "Did you explicitely add it to the list of libs to link?"

DialogBlocks is an UI builder and not a project manager. The libs against which you link are always indicated in the build options of your project. The search directories are only the locations for searching, but you have to tell to the linker what you want to search in these locations.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 488
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: wxWebView on trunk

Post by raananb »

Yes, but I wrongly surmised that DialogBlocks does the job fully...
Post Reply