mono/cxxi — Issue #1: Qt example not working on Linux
Author: robpvn
Created: 2011-12-24 10:33:27+00:00
State: open

Currently I'm on OpenSUSE 11.4 x64 with GCC 4.5.1, Mono 2.10.2 and GCC-XML compiled from CVS source. The hello world example works as expected.

After running make in the qt directory, compilation proceeds without any errors but with three warnings that seem rather harmless, included here for completeness:

generated/QApplication.cs(228,35): warning CS0108: `Qt.Gui.QApplication.Exec()' hides inherited member `Qt.Gui.QCoreApplication.Exec()'. Use the new keyword if hiding was intended
generated/QCoreApplication.cs(120,35): (Location of the symbol related to previous warning)
src/QPoint.cs(10,29): warning CS0414: The private field `Qt.Gui.QPoint.xy' is assigned but its value is never used
src/QPoint.cs(10,33): warning CS0414: The private field `Qt.Gui.QPoint.yx' is assigned but its value is never used

When trying to run the resulting hello.exe, it crashes with this exception:

Unhandled Exception: System.TypeLoadException: Could not load type 'Qt.Gui.QApplication' from assembly 'Qt.Gui-binding, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

I figure this has something to do with the library not being loaded properly, and right enough there is no .so file in the directory. So looking at Makefile.am I see that libQtGui-inline.so has been commented out from the make all routine. Removing the comment (or just running make libQtGui-inline.so) gets me this:

g++: QtGui: No such file or directory
g++: QtCore: No such file or directory
cc1plus: error: unrecognized command line option "-framework"
cc1plus: error: unrecognized command line option "-framework"
make: *** [libQtGui-inline.so] Error 1

Now, from googling about I gather that the -framework option seems to be only for Mac OS X/Darwin (http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html), so I try changing the framework options to "-I/usr/include/QtCore -I/usr/include/QtGui". Now it compiles without error and I get my .so, but running hello.exe still gives the same exception.

Is there something else that is missing, like should the actual Qt .so files from usr/lib be copied into the folder as well? I noticed that libQtGui-inline.so is compiled with the -m32 option, is this something that should be left alone or should it be changed when running on a 64-bit machine?