Linking problem with QtD

Eldar Insafutdinov e.insafutdinov at gmail.com
Thu Oct 29 23:04:24 PDT 2009


Qian Xu Wrote:

> albatroz Wrote:
> 
> > 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 (trunk-r309.zip)
> > >> 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
> > >> (http://www.dsource.org/projects/qtd/wiki/MacCaseStudy)
> > >> 
> > >> I got many linking errors:
> > >> 
> > [code]../../../../build_dir/build/lib/libqtdgui.a(QPrintDialog_shell.cpp.o):
> > >> 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 build.sh. 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
> > > (http://www.dsource.org/projects/qtd/wiki/MacCaseStudy 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.
> > 
> > Hello,
> > 
> > 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/libQtGui.so -L-lqtdgui -L-lqtdcore -L-lQtCore -L-lQtGui 
> > 
> > This allows me to have several folders with different versions.
> 
> I am considering two possible reasons:
> 1. I linked to a wrong Qt-library
> 2. The QtD is not compatible with Qt 4.5.3 (I Saw the build package uses Qt 4.5.2, maybe those undefined references comes from Qt 4.5.3)
> 
> I have also downloaded a pre-compiled QtD library from code.google.com, it works. I can compile Hello world programs. However, this version does not contain all classes as the library I was trying to build. If later I find that some important classes are missing, it will be a big problem for choosing QtD.

All Qt versions keep forward binary compatibility and a full compatibility within a major version, 4.5.3 contains only bug fixes compared to 4.5.2. Version from code.google.com is a waaaaay to old, so I would not even consider it. Have you tried to turn on BUILD_EXAMPLES option in cmake? It will build all examples bundled with qtd.


More information about the Digitalmars-d-learn mailing list