Using gtkmm 2.6 & glibmm 2.6 & libsigc++ 2.0 compiled by gcc 4.0



Hi all,
I am using the gtkmm 2.6 & glibmm 2.6 & libsigc++ 2.0 libraries compiled by gcc 4.0
the C flags using to compile these 3 libraries are:

-mcpu=pentium4 -O3 -fomit-frame-pointer -ftracer -malign-double -minline-all-stringops -finline-functions

And I write a small gtkmm sample program to test whether it works:

===================================
#include <gtkmm.h>

class MyWidget : public Gtk::Window
{
  Gtk::VBox vbox;

public:

  inline
  MyWidget()
  {
  }
};

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

  MyWidget my;
  Gtk::Main::run(my);

  return 0;
}
======================================

And I compile this sample program using

g++ sample.cpp `pkg-config gtkmm-2.4 --cflags --libs`

the g++ version is 4.0

but when I execuate ./a.out
This program receives a segmentation fault error.
However, this program ran fine when I use gcc 3.4 to compile these 3 libraries and my sample program.

I try to figure out what's wrong,
so I do some more testing.

I change one line of the sample program:

Gtk::VBox vbox;

to

Gtk::Frame frame;

then compiled by gcc 4.0 again.

Now, this sample program runs fine~!

Cound anyone figure out what's wrong here?
Should I switch to gcc 4.0 to compile gtkmm libraries and programs which use it?

Thanks a lot.

---
Wei
http://www.csie.ntu.edu.tw/~r88052/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]