Linking problem with QtD

albatroz rmcjustino at
Thu Oct 29 15:53:21 PDT 2009

Eldar Insafutdinov wrote:

> Qian Xu Wrote:
>> Hi All,
>> I have almost built the first demo, but ...
>> The components I have are as follows:
>> 1. QtK SDK (LGPL edition) 4.5.3
>> 2. the latest svn version of QtD (
>> 3. DMD 1.050
>> 4. Tango (current from trunk)
>> 5. Platform: openSUSE 11.1.
>> 6. cmake 2.6
>> After QtD was built successfully, I try to compile the demo
>> (
>> I got many linking errors:
>> In function `qtd_QPrintDialog_setOption_PrintDialogOption_bool':
>> QPrintDialog_shell.cpp:(.text+0x20b): undefined reference to
>> `QPrintDialog::setOption(QAbstractPrintDialog::PrintDialogOption, bool)'
>> ../../../../build_dir/build/lib/libqtdgui.a(QPrintDialog_shell.cpp.o): In
>> function `qtd_QPrintDialog_options':
>> QPrintDialog_shell.cpp:(.text+0x22b): undefined reference to
>> `QPrintDialog::options() const'[/code]
>> There are many undefined references. I checked the source and the '.a'
>> files. These functions are defined correctly.
>> Have I still forget something by linking the demo or building the
>> library?
>> Any hint is welcome
> Hi!
> Undefined symbols that are missing are from Qt libs. I'd recommend to do
> 'make install' after you build QtD (don't forget to specify
> CMAKE_INSTALL_PREFIX option in cmake prior to build to point to the
> directory where you have your dmd toolchain) and then look into the build
> scripts of the examples which typically have a name They contain
> the command line with all necessary libraries to link, typically:
> -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui
> I saw you made the reference to this link
> ( which contains this
> command line option, but still I don't understand why you get undefined
> symbols like QPrintDialog::options() const which belongs to libQtGui.


I decided not to install it globally, first export to ldd the path to your 
QT lib folder

export LIBRARY_PATH=/usr/lib64/qt4/

and build the examples using the complete path of libQtGui

-L/usr/lib64/qt4/ -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui 

This allows me to have several folders with different versions.

More information about the Digitalmars-d-learn mailing list