Results 1 to 5 of 5

Thread: problems with gtksourceview

  1. #1
    Join Date
    Nov 2007
    Location
    Denmark
    Beans
    44
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Question problems with gtksourceview

    hi all

    I'm currently making a C++/GTK+ application, where I want to use the GtkSourceView. I installed the libgtksourceview2.0-dev installed, and in some examples and in the gedit source code I've seen that you include it with #include <gtksourceview/gtksourceview.h>, but when I do that it tells me that it can't find it.
    I looked into usr/include, and noticed that the gtksourceview folder is inside a "gtksourceview-2.0" folder, but when I include #include <gtksourceview-2.0/gtksourceview/gtksourceview.h>, it gives errors from the included file that it can't find a file that's in the gtksourceview folder.
    Then I tried to copy the gtksourceview folder to usr/include, and now it can include, but when I tries to call a function, it gived me a "undefined reference to gtk_source_view_new()" error, but I know that it can see the functions, because when I call it with other arguments, it's telling me that the arguments of gtk_source_view_new() is wrong.

    What am I doing wrong? And how do I install and use gtksourceview?

  2. #2
    Join Date
    Apr 2005
    Location
    Glasgow, Scotland
    Beans
    1,642

    Re: problems with gtksourceview

    1. GTK+ is C, not C++, if you want to use C++, use gtkmm
    2. You need to use pkg-config, probably gcc -Wall `pkg-config --cflags --libs gtksourceview-2.0` -o out in.c
    Last edited by bruce89; October 23rd, 2008 at 04:52 PM.
    A Fedora user

  3. #3
    Join Date
    Jul 2006
    Location
    Germany
    Beans
    1,805

    Re: problems with gtksourceview

    As mentioned, you need to tell the compiler to link against the library. Try
    Code:
    g++ yoursourcefile.cc `pkg-config --cflags --libs gtksourceview-2.0`
    Check the man page of pkg-config for more information.
    ...

  4. #4
    Join Date
    Nov 2007
    Location
    Denmark
    Beans
    44
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: problems with gtksourceview

    Thanks a lot, the compile option was everything i needed

    And BTW I know that GTK+ is for C and GTKMM for C++, but I like the C++ functions and GTK+ setup and it's working fine...

    Thanks again

  5. #5
    Join Date
    Apr 2006
    Location
    Hamilton, New Zealand
    Beans
    198
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: problems with gtksourceview

    A while ago I did a blog post about getting syntax highlighting working with gtksourceviewmm-2.0 and giomm, I know your using the C libraries but the code shouldn't be hard to translate.

    http://mlowen.com/?p=15

    I don't know if need/want it, but I thought it might be helpful.
    Last edited by cabalas; October 24th, 2008 at 04:11 AM. Reason: damn writing sentances that don't make sense

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •