[Qt-interest] cross platform
Farid Derradji
farid.derradji at ITWM.fraunhofer.de
Thu Oct 8 18:17:22 CEST 2009
Hello Raffael,
first of all you don't need either qmake or Qt-Creator at all; just use
for example make instead.
QT CORE FUNCTIONALITY
Since you only need core functionality from Qt, you only need Module
*QtCore* (see for example http://doc.trolltech.com/4.3/qtcore.html).
This means that you have to add include statement
#include <QtCore>
^^^^^^^^^^^^^^^^^
in all sources (or headers) of your project which are Qt dependent.
Also, you have to explicitely specify Library libQtCore.a in your link
declarations, if you do not use qmake nor Qt-Creator.
DETERMINING BIT WIDTH
The bit width is not dependent on the operating system but from the used
processor architecture:
For example for an Intel (-compatible) architecture you have to specify
the following:
-m32 as compile flag for 32 bit width
-m32 as linker option for 32 bit with
and
-m64 as compile flag for 64 bit width
-m64 as linker option for 64 bit with
EXAMINING ENDIANESS
Endianess of your local processor only matters if you are directly
working with binary data (neither integers, floats, etc. nor strings).
The following code fragments (in C++) will work:
bool isLittleEndian()
{
return (*reinterpret_cast<const short*>("\1\0") == 1);
}
bool isBigEndian()
{
return !isLittleEndian();
}
LINE SEPARATORS IN TEXT FILES
Be aware that Linux and Mac OS are using *different line separators* in
their text files.
If you are using the Qt text stream classes in QtCore, you don't have to
bother the differences, because they are handled by Qt.
But if you are not (for example, because you are using the ordinary
stream classes from Standard C++), you have to take into account the
differences.
I hope I could help you
Farid
More information about the Qt-interest-old
mailing list