Thread: GTK and OpenCV winter shutdown goals

  1. #1
    Registered User
    Join Date
    Dec 2016
    Posts
    2

    GTK and OpenCV winter shutdown goals

    I've been programming in C for ~6 years, I have so many nice functions tucked away so I'm getting stuck in my ways. I have some time off and would like to learn how to use GTK and openCV. I'v never been good at downloading and Linking Libraries. I have tried both in the past with no luck. I know if i post to the specific forum I will just get told not to use basic C any more. so I'm setting up shop here. I'm using CodeBlocks on a Linux PC and a raspberry pi. I know I'm not asking a question (yet) I'm just starting a thread to post my questions to.

  2. #2
    Registered User
    Join Date
    Dec 2016
    Posts
    2
    So far luck with the GTK part. Raspberry pi 3 with Jessie, Code::Blocks 13.12.
    From terminal the obligatory:
    Code:
    sudo apt-get update
    then:
    Code:
    sudo apt-get install libgtk2.0-dev
    I then made a file hellogtk.c with the code:
    Code:
    #include <gtk/gtk.h>
    
    int main(int argc, char *argv[])
    {
        GtkWidget *window;
    
    
        gtk_init(&argc, &argv);
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_widget_show(window);
    
    
        gtk_main();
    
    
        return(0);
    }
    source
    then I could compile the program from terminal with:
    Code:
    gcc hellogtk.c -o hellogtk `pkg-config --cflags --libs gtk+-2.0`
    To get Code::Blocks to compile it I found this
    Click 'settings' then 'Compiler...' then add
    Code:
    `pkg-config --cflags gtk+-2.0 `
    to the 'Other options' field
    Then click 'linker settings' and add
    Code:
    `pkg-config --libs gtk+-2.0 `
    to the 'other linker options'
    Now I can compile GTK code from Code::Blocks. Next step is getting it to do something useful.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    This is the C programming board, so I doubt anyone will tell you "don't use C".

    Quote Originally Posted by scootergarrett View Post
    Now I can compile GTK code from Code::Blocks. Next step is getting it to do something useful.
    You might want to follow the official GTK+2 tutorial. If you can understand all of the examples here then you should be in good shape:
    GTK+ 2.0 Tutorial

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c with opencv
    By smuthukumarbsc in forum C++ Programming
    Replies: 1
    Last Post: 09-01-2011, 10:31 PM
  2. the three mutually exclusive goals of programming
    By megafiddle in forum General Discussions
    Replies: 56
    Last Post: 08-29-2011, 07:08 PM
  3. Winter 2006 72 Hour Game Development Competition
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-26-2006, 08:34 PM

Tags for this Thread