You are not logged in.

#1 2009-04-21 19:23:07

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

WebKit/GTK problem - gcc not finding function

If I attempt to compile a little program I'm working on, this happens:

20:20:41 /home/barrucadu/tmp/misc % gcc gtk.cpp -o gtk.o `pkg-config --cflags --libs gtk+-2.0` -I/usr/include/webkit-1.0 -I/usr/include/libsoup-2.4
/tmp/ccx65jx1.o: In function `main':
gtk.cpp:(.text+0x7f): undefined reference to `webkit_web_view_new'
/tmp/ccx65jx1.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Here's any possibly relevant information:

20:20:56 /home/barrucadu/tmp/misc % pkg-config --cflags --libs gtk+-2.0
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12  -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0  

20:22:31 /home/barrucadu/tmp/misc % grep webkit_web_view_new /usr/include/webkit-1.0/webkit/webkitwebview.h
webkit_web_view_new (void);

And here is the code:

#include <gtk/gtk.h>
#include <webkit/webkitwebview.h>

/* Called when the window manager sends the delete signal. Returning true ignores the signal. */
static gboolean delete_event(GtkWidget *widget,
                             GdkEvent  *event,
                             gpointer   data)
{
  return false;
}

/* Called when the main window is destroyed. Stops the GTK loop and so ends the program. */
static void destroy(GtkWidget *widget,
                    gpointer   data)
{
  gtk_main_quit();
}

/* The main function. Return number indicates success or error. */
int main(int   argc,
         char *argv[])
{
  gtk_init(&argc, &argv);
  
  /* Create a new window and set some attributes. */
  GtkWidget *window;
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width(GTK_CONTAINER (window), 10);
  gtk_window_set_title(GTK_WINDOW (window), "Foo");

  /* Create a new webkit instance and add it to the window. */
  GtkWidget *webview;
  webview = webkit_web_view_new();

  /* Attach two signals to the window, delete and destroy. */
  g_signal_connect(G_OBJECT (window), "delete_event",
                   G_CALLBACK (delete_event), NULL);
    
  g_signal_connect(G_OBJECT (window), "destroy",
                   G_CALLBACK (destroy), NULL);

  /* Show the window and start the main GTK loop. */
  gtk_widget_show (window);  
  gtk_main();
  
  return 0;
}

Offline

#2 2009-04-21 20:22:02

kumyco
Member
From: somewhere
Registered: 2008-06-23
Posts: 153
Website

Re: WebKit/GTK problem - gcc not finding function

need as well

`pkg-config --cflags --libs webkit-1.0`

you're missing a -lwebkit-1.0 and its dependencies

Last edited by kumyco (2009-04-21 20:22:33)

Offline

#3 2009-04-21 22:54:38

bremac
Member
Registered: 2008-09-13
Posts: 13

Re: WebKit/GTK problem - gcc not finding function

Barrucadu wrote:

If I attempt to compile a little program I'm working on, this happens:

20:20:41 /home/barrucadu/tmp/misc % gcc gtk.cpp -o gtk.o `pkg-config --cflags --libs gtk+-2.0` -I/usr/include/webkit-1.0 -I/usr/include/libsoup-2.4
...
/tmp/ccx65jx1.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

GCC is used to compile C language source files. In order to compile C++ source you want to use g++, which will resolve your second error.

Offline

Board footer

Powered by FluxBB