PDA

View Full Version : Cannot compile in Suse. OK with mingw and studio 2005 on Windows XP.



zotric
28th December 2007, 18:50
Program compiles in Studio 2005 and with mingw on Windows so I think it has to be something to do with how qmake works in Linux.

I'm using qt 4.3.3 on Suse Linux 10.3 (have tried earlier versions also).

Previous version of the program compiled OK on both Windows and Linux. I have added cImg template libarary and also a custom widget (modelled on the icon editor in C++ GUI Programming with Qt4)

Other people (not here, I don't think) seem to have had the problem and one of the suggestions I tried was a hack that #undefs the offending items. That did not seem to make any difference and, in any case, would not be a very good fix to my way of thinking!

Many thanks in advance.


Errors as follows (4.3.2 version - 4.3.3 is similar)


cd '/home/david/Neo/Neo' && gmake
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.3.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.3.2/include/QtCore -I/usr/local/Trolltech/Qt-4.3.2/include/QtGui -I/usr/local/Trolltech/Qt-4.3.2/include -I. -o Column.o Column.cpp
In file included from /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qmetatype.h:46,
from /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qvariant.h:45,
from /usr/local/Trolltech/Qt-4.3.2/include/QtCore/QVariant:1,
from ui_MPF.h:13,
from InOut.h:25,
from NeoRegion.h:26,
from Column.h:27,
from Column.cpp:24:
/usr/local/Trolltech/Qt-4.3.2/include/QtCore/qdatastream.h:46:2: error: #error qdatastream.h must be included before any header file that defines Status
In file included from /usr/local/Trolltech/Qt-4.3.2/include/QtCore/qvariant.h:45,
from /usr/local/Trolltech/Qt-4.3.2/include/QtCore/QVariant:1,
from ui_MPF.h:13,
from InOut.h:25,
from NeoRegion.h:26,
from Column.h:27,
from Column.cpp:24:
/usr/local/Trolltech/Qt-4.3.2/include/QtCore/qmetatype.h:50:2: error: #error qmetatype.h must be included before any header file that defines Bool

jpn
28th December 2007, 18:57
error: #error qdatastream.h must be included before any header file that defines Status
error: #error qmetatype.h must be included before any header file that defines Bool

Have you tried doing what's being suggested - switching the order of includes? Try including Qt headers first and external lib headers afterwards.

zotric
28th December 2007, 22:26
Well I had some vague idea about this but they are not my headers are they?
I would need to change the build files which would not be ideal.
However, unless anyone comes up with anything else I'll certainly have a go.

It seems to me that qmake should be able to work out what order to include the headers.
Have I misunderstood something?
Thanks

jpn
28th December 2007, 22:33
Well, I don't know what is "cImg template libarary" but aren't you including its headers somewhere in your program?

What I meant was to change:


// somefile.cpp
#include <some_cImg_header> // currently, cImg is included first and then
#include <some_Qt_header> // something from Qt after is included afterwards

to


// somefile.cpp
#include <some_Qt_header> // include stuff in reverse order so that qdatastream.h and qmetatype.h
#include <some_cImg_header> // won't get mixed up about stuff defined in cImg header

high_flyer
29th December 2007, 01:27
I'm using qt 4.3.3 on Suse Linux 10.3 (have tried earlier versions also).
Do you mean earlier versions of Suse or Qt?