You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include "webview.h"
#include "stdlib.h"
#ifdef _WIN32
int WINAPI WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/,
LPSTR /*lpCmdLine*/, int /*nCmdShow*/) {
#else
int main(int argc, char* argv[]) {
#endif
webview::webview w(false, nullptr);
w.set_title("Basic Example");
w.set_size(480, 320, WEBVIEW_HINT_NONE);
w.set_html("Thanks for using webview!");
WebKitWebView *wk2_webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(webView));
w.run();
return 0;
}
But I'm getting the error : error: invalid cast from type ‘webview::webview’ to type ‘GTypeInstance*’ {aka ‘_GTypeInstance*’} :
raphy@raohy:~/webview-prj$ g++ basic.cc -std=c++11 -Ilibs/webview $(pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0) -o build/basic && ./build/basic
In file included from basic.cc:1:
libs/webview/webview.h: In member function ‘void webview::detail::gtk_webkit_engine::eval(const string&)’:
libs/webview/webview.h:689:35: warning: ‘void webkit_web_view_run_javascript(WebKitWebView*, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)’ is deprecated: Use 'webkit_web_view_evaluate_javascript' instead [-Wdeprecated-declarations]
689 | webkit_web_view_run_javascript(WEBKIT_WEB_VIEW(m_webview), js.c_str(),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
690 | nullptr, nullptr, nullptr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/webkitgtk-4.0/webkit/WebKitPrintOperation.h:29,
from /usr/include/webkitgtk-4.0/webkit2/webkit2.h:74,
from libs/webview/webview.h:579,
from basic.cc:1:
/usr/include/webkitgtk-4.0/webkit/WebKitWebView.h:526:1: note: declared here
526 | webkit_web_view_run_javascript (WebKitWebView *web_view,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/gobject/gobject.h:24,
from /usr/include/glib-2.0/gobject/gbinding.h:29,
from /usr/include/glib-2.0/glib-object.h:22,
from /usr/include/glib-2.0/gio/gioenums.h:28,
from /usr/include/glib-2.0/gio/giotypes.h:28,
from /usr/include/glib-2.0/gio/gio.h:26,
from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28,
from /usr/include/gtk-3.0/gdk/gdk.h:32,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from libs/webview/webview.h:578,
from basic.cc:1:
basic.cc: In function ‘int main(int, char**)’:
/usr/include/glib-2.0/gobject/gtype.h:2458:49: error: invalid cast from type ‘webview::webview’ to type ‘GTypeInstance*’ {aka ‘_GTypeInstance*’}
2458 | ((ct*) (void *) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
| ^
/usr/include/glib-2.0/gobject/gtype.h:501:66: note: in expansion of macro ‘_G_TYPE_CIC’
501 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type))
| ^~~~~~~~~~~
/usr/include/gtk-3.0/gtk/gtkcontainer.h:38:42: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’
38 | #define GTK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
basic.cc:28:23: note: in expansion of macro ‘GTK_CONTAINER’
28 | gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(webView));
| ^~~~~~~~~~~~~
basic.cc:28:52: error: ‘webView’ was not declared in this scope; did you mean ‘webview’?
28 | gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(webView));
| ^~~~~~~
/usr/include/glib-2.0/gobject/gtype.h:2458:66: note: in definition of macro ‘_G_TYPE_CIC’
2458 | ((ct*) (void *) g_type_check_instance_cast ((GTypeInstance*) ip, gt))
| ^~
/usr/include/gtk-3.0/gtk/gtkwidget.h:58:44: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’
58 | #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
basic.cc:28:41: note: in expansion of macro ‘GTK_WIDGET’
28 | gtk_container_add(GTK_CONTAINER(w), GTK_WIDGET(webView));
| ^~~~~~~~~~
raphy@raohy:~/webview-prj$
I do not get any errors, but the web page is not rendered:
gcc version :
raphy@raohy:~/webview-prj$ gcc --version
gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
O.S. : Ubuntu 22.04
How to correctly render the web page?
The text was updated successfully, but these errors were encountered:
@SteffenL . Yes! With w.navigate("https://example.org") the page is rendered
I can already go forward and backward, but to work with the browser history ?
Where can I find information about how to handle the navigate(...) properties and settings?
Following the indications found here: https://wiki.gnome.org/Projects/WebKitGtk/ProgrammingGuide/Tutorial I'm trying to render a web page within a webview window:
But I'm getting the error :
error: invalid cast from type ‘webview::webview’ to type ‘GTypeInstance*’ {aka ‘_GTypeInstance*’}
:If I create a GtkWidget* mainwindow :
I do not get any errors, but the web page is not rendered:
gcc version :
O.S. : Ubuntu 22.04
How to correctly render the web page?
The text was updated successfully, but these errors were encountered: