Thread: Kickstart me for GUI app development!

  1. #1
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355

    Kickstart me for GUI app development!

    I've recently switched to Linux for learning to develop and hopefully one day to assist the community. I've learned to use the autotools and vim. I know C/C++ and a bit Perl.
    I was wondering what is the best way to start developing GUI appz for Linux.
    I need something that is rapid straightforward, and have no need for GUI design tools for the moment. Just a suggestion on which software interfaces would be most appropriate if it is not too much to ask?
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    The most popular three are Qt (KDE is based on this), GTK+ (Gnome is based on this), and wxWindows (the Linux version is implemented as a layer on top of GTK+). You typically use whatever fits your preferred desktop environment. Xfce also makes use of GTK+. If you don't like the C interface, you can use GTK-- (GTKmm), the C++ wrapper.
    Oh, and Tk is very popular in scripting languages, such as Tcl, Perl or Python.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    Thanx i think i'll go for GTK+ then.
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

  4. #4
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    Ok, i got the developer kit, and the doc... but i have a small problem.
    I used a script, to make vim ctags for assisting with code autocompletion. (The interface has long long names... )
    Code:
    #!/bin/bash
    #
    # addtag : A small script to make a whole directory of sources into a tag file
    # located at the current directory.
    #
    
    if [ -z $1 ];
    then
            echo "Usage: addtag DIRECTORY <tags file>";
            exit -1;
    fi;
    
    tagdir=$1;
    if [ -z $2 ];
    then
            tagfile="tags";
    else
            tagfile=$2;
    fi;
    
    basedir=`basename $tagdir`;
    linkfile=".$basedir";
    if [ -f $linkfile ];
    then
            rm -f $linkfile;
    fi;
    /bin/ln -s $tagdir $linkfile;
    
    ctags -R --language-force=c -f $tagfile $linkfile;
    I invoked the script as: ./addtag /usr/include/gtk-2.0 gtk-2.0.tags
    Then i edited the appropriate tags entry in ~/.vimrc
    My problem is that most gtk-2.0 functions are not appearing in the resulting tag file.
    I read the man of ctags but failed to realize if an option would amend things.
    is my --language-force switch to ctags wrong? Has anyone got a good link with vim ctags readily compiled to use, or knows how to create one?

    I know this is a bit off-topic but any help would be appreciated...
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

  5. #5
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    I'm also interested in learning how to write gtk apps in linux. I'm sorry I don't have an answer to the scripting question, but I do have another question: When I try to compile my first app, it can't find my included header file gtkmm.h or anything it requires. I know it's installed, and I set my PATH variable to point to the directory where it is, but it's still not found. Does anybody know what I might be doing wrong?
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  6. #6
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    When compiling you can use:
    Code:
    compile:
    gcc -o xxx.o -c xxx.c `pkg-config --flags gtk-2.0`
    link:
    gcc -o xxx a.o b.o c.o `pkg-config --libs gtk-2.0`
    This expands the include directories needed to correctly compile, and libraries needed to link when linking. Don't forget the backquotes.
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    PATH is for programs. include path is for includes.

  8. #8
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    xuftugulus: this didn't work for me...
    robwhit: how do I edit include path?
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  9. #9
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    Sorry to bump, but I guess it's better than starting a new thread. I'm still wondering how to get started making a basic prog with a gui in linux. I'm running UbuntuStudio 7.10, installed gtkmm from synaptic, but it can't find the header files, and I don't know how to configure it... Can anybody help? I'd rather not move my source code to the directory containing the headers.
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  10. #10
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    From expirience, I'd suggest Gtk+

    If you don't like creating the GUI by hand, use glade and implement via GtkBuilder but libglade in the meantime, AFAIK GtkBuilder isn't 100&#37; complete. You should note libglade is being superseded by GtkBuilder.

    > how do I edit include path?
    Quote Originally Posted by man gcc
    Code:
         -Idir
             Add the directory dir to the head of the list of
             directories to be searched for header files.  This can
             be used to override a system header file, substituting
     your own version, since these directories are searched
             before the system header file directories.  However, you
             should not use this option to add directories that
             contain vendor-supplied system header files (use
             -isystem for that).  If you use more than one -I option,
             the directories are scanned in left-to-right order; the
             standard system directories come after.
    
             If a standard system include directory, or a directory
             specified with -isystem, is also specified with -I, the
             -I option will be ignored.  The directory will still be
             searched but as a system directory at its normal
             position in the system include chain.  This is to ensure
             that GCC's procedure to fix buggy system headers and the
             ordering for the include_next directive are not
             inadvertently changed.  If you really need to change the
             search order for system directories, use the -nostdinc
             and/or -isystem options.
    
         -I- Any directories you specify with -I options before the
             -I- option are searched only for the case of #include
             "file"; they are not searched for #include <file>.
    
             If additional directories are specified with -I options
             after the -I-, these directories are searched for all
             #include directives.  (Ordinarily all -I directories are
             used this way.)
    
             In addition, the -I- option inhibits the use of the
             current directory (where the current input file came
             from) as the first search directory for #include "file".
             There is no way to override this effect of -I-.  With
             -I. you can specify searching the directory which was
             current when the compiler was invoked.  That is not
             exactly the same as what the preprocessor does by
             default, but it is often satisfactory.
    
             -I- does not inhibit the use of the standard system
             directories for header files.  Thus, -I- and -nostdinc
             are independent.
    Last edited by zacs7; 02-24-2008 at 02:37 AM.

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Also, gtkmm probably uses pkg-config to give you its required compiler flags.

    Type
    pkg-config --cflags gtkmm-2.4
    on the command line and it ought to tell you the compiler flags you need to compile gtkmm programs. Type
    pkg-config --libs gtkmm-2.4
    and it will tell you the linker flags.

    If you compile from the command line, you can get these directly.
    Code:
    g++ -c main.cpp `pkg-config --cflags gtkmm-2.4`
    g++ -c other.cpp `pkg-config --cflags gtkmm-2.4`
    g++ -c module.cpp `pkg-config --cflags gtkmm-2.4`
    
    g++ -o program main.o other.o module.o `pkg-config --libs gtkmm-2.4`
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #12
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    Thank you guys very much, I finally got my simple gtk app running. I just realized that "back quotes" is the key above tab, because I was just trying to use the single quote key next to enter. I'm not used to using back quotes... I'll be sure to post when I run into any more problems (which will probably be pretty soon).
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  13. #13
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I don't like backquotes either, for several reasons: they can be hard to distinguish from single quotes, as you have seen, and you can't nest them, and some other people evidently agree with me because I'm pretty sure they're now deprecated according to the POSIX standard. Not that they'll ever get rid of them, but still.

    There is an alternative: $(code) is the same as `code`. You can nest them, too.
    Code:
    grep -n function $(find -name $(cat filename))
    There are a few troubles with this notation as well, however. Most notably, Makefiles use the same $() syntax for their variables. You can get around this, however, by using $(shell code) instead of `code` in Makefiles.

    Good luck with GTK+.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. best program to start
    By gooddevil in forum Networking/Device Communication
    Replies: 4
    Last Post: 05-28-2004, 05:56 PM
  3. pasword app
    By GanglyLamb in forum C Programming
    Replies: 2
    Last Post: 06-07-2003, 10:28 AM
  4. Planned Development Community Idea (important)
    By cozman in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-12-2002, 12:13 PM