Author Topic: Gtkmm  (Read 26137 times)

Priit

  • Guest
Gtkmm
« on: September 11, 2005, 09:10:26 pm »
Anyone using gtkmm ( http://www.gtkmm.org/ ) with code::blocks?

I downloaded a Developer (Full) Environment  package here-> http://www.pcpm.ucl.ac.be/~gustin/win32_ports/ ...the first one.

But how i integrate it with CB. I added gtkmm lib and include directories to my project but it won't compile. Obviously i missed some drectories :).

Code i am trying to compile:

Code
#include <gtkmm.h>

int main(int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);

    Gtk::Window window;

    Gtk::Main::run(window);
   
    return 0;
}

Error:

Code
Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Priit\Desktop\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe      -I..\..\..\Dev\gtkmm\include  -IC:\Dev\MinGW\include -c main.cpp -o .objs\main.obj
main.cpp:1:19: gtkmm.h: No such file or directory
main.cpp: In function `int main(int, char**)':
main.cpp:5: error: `Gtk' has not been declared
main.cpp:5: error: `Main' undeclared (first use this function)
main.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:5: error: expected `;' before "kit"
main.cpp:7: error: `Gtk' has not been declared
main.cpp:7: error: `Window' undeclared (first use this function)
main.cpp:7: error: expected `;' before "window"
main.cpp:9: error: `Gtk' has not been declared
main.cpp:9: error: `window' undeclared (first use this function)
main.cpp:9: error: `run' undeclared (first use this function)
Process terminated with status 1 (0 minutes, 0 seconds)
11 errors, 0 warnings
 

Does anyone has cb template for gtkmm?  :mrgreen:

grv575

  • Guest
Re: Gtkmm
« Reply #1 on: September 12, 2005, 03:28:07 am »
OK, here's a walkthrough.  If you want to create a template and sumbit it then that would be great.

- Download the gtkmm on win32 Developer (Full) Environment at the link you gave
http://www.pcpm.ucl.ac.be/~gustin/win32_ports/gtkmm.html

This package is all that's needed to get started writing GTK+ apps on win32 in C++.  The installer will download the necessary gtk+ development stuff.  I installed both to the default paths (c:\GTK)

- Note that GTK+ on win32 informs that the flag
"-mms-bitfields"
should be passed as a compiler option.
see: http://www.gimp.org/win32/

- Create a new Win32 GUI Application (for now since there is no template) and choose "Do not create any files"

- Activate the project, create a new file, cut and paste the code you were trying to compile:
Code
#include <gtkmm.h>

int main(int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    Gtk::Main::run(window);
    return 0;
}
and save as test.cpp

- goto project->build options and then add the stuff seen in the following screen shots  :D

Note that I used relative paths, so yours may differ somewhat, depending on where you created the project.  After everything is as shown in the screens below, hit OK, and then compile (build).  You should be able to click the run button and see a working
app.







takeshimiya

  • Guest
Re: Gtkmm
« Reply #2 on: September 12, 2005, 08:55:37 am »
A side note that doesn't contribute anything :P:

The GtkMM is the worst gui toolkit I ever saw.
The code & internal design seems good, but the implementation is the worst and slower, it's perhaps slower than Java's SWT.
So I wouldn't recommend it to anyone.

zieQ

  • Guest
Re: Gtkmm
« Reply #3 on: September 12, 2005, 09:10:37 am »
I agree with takeshimiya ;)

grv575

  • Guest
Re: Gtkmm
« Reply #4 on: September 12, 2005, 09:35:40 am »
Does this apply to gtk+ on win32 as well (with it's ugly static C funtions everywhere  :P)?  Or is it decent speed?

takeshimiya

  • Guest
Re: Gtkmm
« Reply #5 on: September 12, 2005, 01:20:27 pm »
This applies to gtk2+ on every platform as well :), but gtkmm is like 10x slower than gtk2+.
Perhaps the latest release of gtk2+ 2.8 paints a little faster thanks to the cairo graphics library being the backend.
But anyways, they doesn't suffer slowness on paint events only...


When I compared speeds of different toolkits I almost laught, and to compare well you have to do in a old hardware:
CPU: Pentium 133, RAM: 64mb, OS: win9x is the one I used

Compile the samples of the toolkits, and run them:
Startup time of the compiled exe:
-gtkmm: 15~20 seconds
-wx: 1 second
-mfc: 1 second
-fltk: 1 second

And the responsiveness! :shock: The others behaves very well (except for the wx combo box when haves lots of elements, and some minor problems of minor cases)
but gtkmm is almost unuseable, when you do a click, everything is so sloooow.
« Last Edit: September 12, 2005, 01:22:01 pm by takeshimiya »

Offline phlox81

  • Multiple posting newcomer
  • *
  • Posts: 53
    • phlox81.de
Re: Gtkmm
« Reply #6 on: September 12, 2005, 05:48:42 pm »
A side note that doesn't contribute anything :P:

The GtkMM is the worst gui toolkit I ever saw.
The code & internal design seems good, but the implementation is the worst and slower, it's perhaps slower than Java's SWT.
So I wouldn't recommend it to anyone.

You talk about GTK or GTKmm ?
GTKmm in my opinion has the BEST C++ Gui Design,
which is around by now. No Macros, just straight
and beautiful OO with C++. Actualy its a pretty good
wrapper around a really wired GUI Toolkit.

phlox

zieQ

  • Guest
Re: Gtkmm
« Reply #7 on: September 12, 2005, 06:55:56 pm »
You could then have a look to QT which is IMHO the most Object Oriented GUI Toolkit. No macros either but a meta object compiler to add missing C++ langage features ;)  (e.g. features from other OO langages such as smalltalk)

My opinion about gtk/gtkmm, too buggy, not really portable (different platforms maintained separatly IIRC), don't know about speed but both previous arguments are too much to deal with  :P

takeshimiya

  • Guest
Re: Gtkmm
« Reply #8 on: September 12, 2005, 07:11:37 pm »
No Macros, just straight and beautiful OO with C++. Actualy its a pretty good
wrapper around a really wired GUI Toolkit.

phlox

That's why I said that the design & code of GTKmm are very good, I used it some time ago, and I used to think that the design was very good, using all the advanced topics of C++, more after trying GTK+ in plain C, which is a pain for those who don't like C.

Everything good, until you use that -almost perfect and mature design- in the real world...
The win32 port isn't very good, I've spent days trying to compile the gtkmm's glade.
I think I've said enough about the usability and speed of the toolkit.

But I had to thank one thing to GTKmm, because it was so slow, I begin to search for a lightweight C++ GUI toolkit.

And then, I found FLTK. It's very amazing, because the design is very clean and C++ mature, with namespaces and all. And guess what, it's fast and the minimal example statically linked weights less than 100k. And the example containing all FLTK widgets weights 500k. You don't find that on any other toolkit.

But soon after I started using it, I noticed it lacked some functionality, Unicode support (a must), some important widgets, etc. And the comunity of FLTK is very small, with the project maintained with 1 or 2 persons.

And then, I found another GUI toolkit, called wxWindows.
At first I didn't liked (unlike the others 2), because the design seemed to be rather old C++ (without namespaces, without using the STL, using MFC like macros, etc).

But after trying to convince myself to look around it, I found it wasn't bad... and it was fast! And the design wasn't bad after all, using inheritance, and very good coded and commented.
Then I discovered that it used native widgets, looking almost the same as an MFC app in win32, a GTK+ app in linux, a Cocoa app in MacOS X, etc.
Later I found that feature to be VERY important if you care about cross-platform.
Well, I started using it, and I'm using it till now, and found it to be the best real world toolkit.

And the downsides I found at start (without using the STL, macros, etc), it was because wx is really cross-platform, and to support a wide range of compilers and platforms, they had to choose not so advanced features of C++. That counts for the wxWidgets 2.x version.

The wxWidgets 3 will use full STL compatibility, and more advances features of C++, etc. (see the wx roadmap for more info)


That's my simplified and reduced history for a search of a GUI crossplatform toolkit where I feel comfortable. :P

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Gtkmm
« Reply #9 on: September 12, 2005, 07:16:00 pm »
The point of wxWidgets is PRECISELY that their processing is done using macros, so the configurations etc are calculated at COMPILE time, as opposed to runtime with other toolkits. This is what makes it so fast.

Of course, we have to trade efficiency for prettiness, but oh well.

zieQ

  • Guest
Re: Gtkmm
« Reply #10 on: September 12, 2005, 07:20:47 pm »
I advocate for QT or wxWidgets which are the most complete OO cross-platform APIs. I prefer QT but the main problem is the license/price to make commercial applications. WxWidgets' one is less restrictive but the API is not as smart as Qt's. You could also have a look to SDL, but C only I think.

takeshimiya

  • Guest
Re: Gtkmm
« Reply #11 on: September 12, 2005, 07:38:12 pm »
Ermm, SDL is only C, and it's my fav choice for developing games along with OpenGL, but it's not a GUI toolkit. :D
However there are some works of GUI toolkits running on top of SDL, like aedGUI, libUFO, libuta, etc. But they aren't mature, perhaps the only time when you'll consider them is when doing OpenGL stuff, and want some widgets, like the config. options inside a game.

About QT: forget it unless you are only in linux. Also the make system is very intrusive because it uses features from the time where C++ was in the first steps.

wxWidgets has the less intrusive make/build system I ever saw (not only in a GUI toolkit), because it comes with a lot of makefiles and project files to a lot of compilers/ides without forcing you.

And both QT and wx, comes from the time where C++ was in the first steps, but wx adapted to more new (not really new, but supported by compilers) when it jumped from wx1.x to wx2.x. And you can expect the same when the transition to wx 3 will occur.
« Last Edit: September 12, 2005, 07:40:14 pm by takeshimiya »

Offline phlox81

  • Multiple posting newcomer
  • *
  • Posts: 53
    • phlox81.de
Re: Gtkmm
« Reply #12 on: September 12, 2005, 08:20:18 pm »
If you like SDL, but would like a more C++ Interface, take a look at www.clanlib.org

zieQ

  • Guest
Re: Gtkmm
« Reply #13 on: September 13, 2005, 08:59:19 am »
About QT: forget it unless you are only in linux. Also the make system is very intrusive because it uses features from the time where C++ was in the first steps.

No, there's also a qpl win32 version since qt4 or maybe a little before... You are not required to use the shipped build system (qmake) to build some projects, i personnaly use cmake  :wink: QT is also supported by many platforms/os !
« Last Edit: September 13, 2005, 09:01:37 am by zieQ »

takeshimiya

  • Guest
Re: Gtkmm
« Reply #14 on: September 13, 2005, 09:37:57 am »
You are not required to use the shipped build system (qmake) to build some projects, i personnaly use cmake  :wink: QT is also supported by many platforms/os !

I was talking about the license. If I remember well, you had to pay to develop on win32.
Maybe that has changed now, but the license is still intrusive, forcing you to make all your projects GPL.
« Last Edit: September 13, 2005, 09:40:30 am by takeshimiya »