This is an old revision of the document!
Table of Contents
Qt
= Other Qt Pages =
- For undocumented features of qmake, including SUBDIR projects with proper dependency hierarchies: http://wiki.qtcentre.org/index.php?title=Undocumented_qmake#SUBDIRS_projects
= Compiling Qt under (k)ubuntu =
- Download and extract Qt
- Use <source lang=“bash”>sudo apt-get install</source> to install the following packages:
- openssl
- libssl-dev
- xorg-dev
- build-essential
- Configure with the following line
<source lang=“bash”> ./configure -no-phonon -no-webkit -no-opengl -openssl </source>
- Build and install with the commands
<source lang=“bash”> (g)make install sudo (g)make install </source>
Building a minimal set of libraries only
If you only want the Qt libraries, and none of the tools or examples, you can save time by using the following command lines <source lang=“bash”> ./configure -no-phonon -no-webkit -no-opengl -openssl -nomake examples -nomake demos (g)make sudo (g)make install </source>
= Compiling Qt under Windows/Visual Studio =
- Download and extract Qt to C:\build\<version>
- Download and extract OpenSSL to C:\build\openssl-0.9.8g. Build it.
- Download and install the Windows SDK (formerly Platform SDK, at the time of writing v6.1)
- For Phonon support, download and install the full DirectX SDK (at time of writing, November 2007 release)
- Set the following environment variables
<source lang=“bash”> OPENSSL_PATH = C:\build\openssl-0.9.8g PATH += C:\build\qt-win-opensource-src-4.4.0\bin QMAKESPEC = win32-msvc2005 </source>
- Run a platform sdk command prompt (The yellow one)
- For Phonon support, execute the DirectX environment script
<source lang=“bash”> C:\Program Files\Microsoft DirectX SDK (November 2007)\Utilities\Bin\dx_setenv.cmd </source>
- Configure with the following command lines
<source lang=“bash”> cd c:\build\qt-win-opensource-src-4.4.0\ configure.exe -debug-and-release -phonon -webkit -direct3d -openssl -I C:\build\Include -L C:\build\Lib </source>
Check the beginning of the output of configure, and ensure all selected options have been correctly enabled)
- Compile with the following command line
<source lang=“bash”> nmake </source>
Improved Debugging output
- Find the autoexp.dat file within the visual studio installation directory and add the following lines just before the Visualiser section
<source lang=“text”> ; Qt Integration QObject =classname=<staticMetaObject.d.stringdata,s> superclassname=<staticMetaObject.d.superdata→d.stringdata,s> QList<*>=size=<d→end,i> QLinkedList<*>=size=<d→end,i> QString=<d→data,su> size=<d→size,u> QByteArray=<d→data,s> size=<d→size,u> QUrl =<d→encodedOriginal.d→data,s> QUrlInfo =<d→name.d→data,su> QPoint =x=<xp> y=<yp> QPointF =x=<xp> y=<yp> QRect =x1=<x1> y1=<y1> x2=<x2> y2=<y2> QRectF =x=<xp> y=<yp> w=<w> h=<h> QSize =width=<wd> height=<ht> QSizeF =width=<wd> height=<ht> QMap<*> =size=<d→size> QVector<*> =size=<d→size> QHash<*> =size=<d→size> QVarLengthArray<*> =size=<s> data=<ptr> QFont =family=<d→request.family.d→data,su> size=<d→request.pointSize, f> QDomNode =name=<impl→name.d→data,su> value=<impl→value.d→data,su> </source>
= Making a project with qmake =
- Create a new project file with the following commandline
<source lang=“bash”> qmake -project -t app -o projectname.pro </source> (In the current version of qmake, the template does not always get correctly applied, it can be fixed with the template below).
<source lang=“text”>
- Visual Studio 2005 template
TEMPLATE = app
- Output binary name
TARGET = myproject DEPENDPATH += .
- Which Qt modules to include
QT += network
- Additional condiguration
CONFIG += warn_on thread CONFIG -= embed_manifest_exe
- Show a console with stderr output in debug mode
win32:CONFIG += console
- Input
HEADERS += main.h SOURCES += main.cpp </source>
Creating the Visual Studio project files
Once the .pro file is made, and indeed every time it is changed, use the following commandline to generate the Visual Studio project files <source lang=“bash”> qmake -tp vc </source>
The project can then be opened in visual studio and compiled as ususal