How to run Gtkmm progs in kdevelop?

Tarjei Knapstad tarjeik at chemcon.no
Fri May 3 14:04:55 BST 2002


On Tue, 30 Apr 2002, abhi s wrote:

> Hi all,
> 
> This is a simple gtkmm program named base.cc which
> displays a window.
> 
> #include <gtk--/main.h>
> #include <gtk--/window.h>
> 
>  int main(int argc, char *argv[])
>  {
>      Gtk::Main kit(argc, argv);
> 
>      Gtk::Window window (GTK_WINDOW_TOPLEVEL);
>      window.show();
> 
>      kit.run();
>      
>      return(0);
>  }
> 
> To compile this in the terminal we use the following
> command:
>  g++ base.cc -o base `gtkmm-config --cflags --libs`
> 
> How do we do the same in kdevelop? How do we set the
> flags and link those particular libraries. 
> 
I assume that setting up a gtkmm project in KDevelop should be no harder 
than this (note - untested)

1. Create a new project. Select "Terminal -> C++" as the project type.
   (The description says that you're setting up a project "with no support 
   for a graphical user interface - don't bother with this, we'll fix it 
   later.) Set up CVS support etc. as you please.

2. Go to Project -> Options...

3. Select "Compiler options" and click the "Flags and warnings" tab.
   In "C++ compiler flags (CXXFLAGS)" insert: 
   `gtkmm-config --cflags --libs-only-L`

4. Select the "Linker flags" tab. In "Additional flags" insert:
   `gtkmm-config --libs`

That should be just about it. However you should also add the gtkmm and 
gtk autoconf macros so that configure will check that you have the proper 
gtk/gtkmm versions for your project. You should insert these macros into 
the file "aclocal.m4" in your project dir (not quite sure if this is the 
correct way, but it works - any1?).

> How do we make an executable which will have all the
> libraries built into it such that we can execute it in
> any linux machine in which the gtkmm libraries are not
> installed ?
> 
This requires that you have built static versions of the gtkmm library 
(and libsigc++ as most people won't have this lib either if they don't 
have gtkmm installed). If you haven't allready done so, build static gtkmm 
and libsigc++ libraries and install them. Now in item 4 in the previous 
description, check the "prevent using shared libraries (-static)" box, and 
you should be all set. (note: the size of your binary will most likely end 
up being enormous...)

Ralf: I've not tested this procedure so it might need some tuning, but 
if/when it works, maybe there should be a FAQ entry added for the gtkmm 
people who might want to use KDevelop (hey I used to be one of them :)? 
Or even make gtk/gtkmm project templates?

Cheers,
-- 
Tarjei Knapstad


-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list