[mercury-users] Re: Compilation errors with Mercury and GTK--

Andy Coates coates_andy at hotmail.com
Fri Feb 8 02:50:22 AEDT 2002


firstly, thank you for all your help Fergus.

I have just a few more questions,

1. With a lot of tweaking, I managed to get a compiled/linked executable 
involving Mercury and C++ (lets assume for know that it actually works ;). 
But in order to achieve this, I had to introduce another Mercury file with a 
dummy main function that simply calls the original C++ main function. This 
was the only way I could get Mmake to link the object files it had compiled.
Is there a way to get Mmake to link using the main function defined in my 
C++ file, and without having a mercury_main function?

2. If the answer to question one is No, then can i pass command line 
arguments through the dummy Mercury main function to the C++ one?


3. Although a compiled/linked executable does result from all the tweaking 
I've been doing with your help, it unfortunately dies horribly. I suspect 
the problem lies with the gtk-- code because of the errors. However, if you 
had any suggestions on why the following happens I'd gladly recieve them


a) If I put the #include <gtk--.h> line in my C++ code before the #including 
of the mercury files, I receive the following compilation errors:
bash-2.05$ mmake
MERCURY_C_COMPILER=g++ mgnuc --high-level-code     -g        
-DMR_MACHDEPS_ALPHA_REGS_H -DMR_MACHDEPS_MIPS_REGS_H 
-DMR_MACHDEPS_SPARC_REGS_H -DMR_MACHDEPS_I386_REGS_H -DMR_MACHDEPS_PA_REGS_H 
-DMR_MACHDEPS_RS6000_REGS_H -DMR_NO_BACKWARDS_COMPAT -g `gtkmm-config 
--cflags` -c cpp_main.cc
In file included from 
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/stl_alloc.h:45,
                 from 
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/alloc.h:21,
                 from 
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/std/bastring.h:39,
                 from 
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/string:6,
                 from /opt/gnome/include/gtk--/base.h:28,
                 from /opt/gnome/include/gtk--.h:70,
                 from cpp_main.cc:4:
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/iostream.h:97: 
`ostream::operator <<(char)' has already been declared in `ostream'
/usr/lib/gcc-lib/i386-slackware-linux/2.95.3/../../../../include/g++-3/iostream.h:217: 
`istream::operator >>(char &)' has already been declared in `istream'
gmake: *** [cpp_main.o] Error 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~


b) If I put the #include <gtk--.h> file after including the mercury files, 
things compile and link, but I get these lovely run time errors!


bash-2.05$ ./mercury_main
In Mercury main, about to call cpp_main...
In cpp_main().
foo_test(42) returns TRUE
foo_test(43) returns FALSE

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

Gtk-WARNING **: gtk_type_create(): unknown parent type `21'.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

Gtk-WARNING **: gtk_type_create(): unknown parent type `21'.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 152 (g_hash_table_insert): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

Gtk-WARNING **: gtk_type_create(): unknown parent type `21'.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 152 (g_hash_table_insert): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 152 (g_hash_table_insert): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 152 (g_hash_table_insert): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 152 (g_hash_table_insert): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 152 (g_hash_table_insert): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 138 (g_hash_table_lookup): assertion 
`hash_table != NULL' failed.

GLib-CRITICAL **: file ghash.c: line 152 (g_hash_table_insert): assertion 
`hash_table != NULL' failed.

Gtk-CRITICAL **: file gtkobject.c: line 579 (gtk_object_new): assertion 
`GTK_FUNDAMENTAL_TYPE (object_type) == GTK_TYPE_OBJECT' failed.

Gtk---WARNING **: Do NOT call constructors with 0 argument! use default 
constructor instead, if such thing exists!


Gtk---WARNING **: castitem == 0 bug; not again!!! Flaming death...


on ***
PC at signal: 1074540778 (400c30ea)
address involved: (nil)
This may have been caused by a stack overflow, due to unbounded recursion.
exiting from signal handler
bash-2.05$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


thanks again for all your help,
Andy

-
-

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list