www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking problem with QtD

reply Qian Xu <qian.xu stud.tu-ilmenau.de> writes:
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
Oct 29 2009
parent reply Eldar Insafutdinov <e.insafutdinov gmail.com> writes:
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.
Oct 29 2009
next sibling parent reply albatroz <rmcjustino gmail.com> writes:
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.
Oct 29 2009
parent reply Qian Xu <qian.xu funkwerk-itk.com> writes:
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.
Oct 29 2009
parent reply Eldar Insafutdinov <e.insafutdinov gmail.com> writes:
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.
Oct 29 2009
parent reply Qian Xu <qian.xu stud.tu-ilmenau.de> writes:
Eldar Insafutdinov wrote:
 
 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.
The problem has been solve. The linker "ld" searches first in "/usr/lib" (Qt 4.4.3) and then my "/my-qt-sdk/lib", even when the path "/usr/lib" is not specified. I checked the man page of "ld". There is an argument "-rpath-link". If it is not specified, the "/usr/lib" will be assumed. So my problem is solve. Thanks for you all. Have a nice day.
Oct 30 2009
parent Eldar Insafutdinov <e.insafutdinov gmail.com> writes:
Qian Xu Wrote:

 Eldar Insafutdinov wrote:
 
 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.
The problem has been solve. The linker "ld" searches first in "/usr/lib" (Qt 4.4.3) and then my "/my-qt-sdk/lib", even when the path "/usr/lib" is not specified. I checked the man page of "ld". There is an argument "-rpath-link". If it is not specified, the "/usr/lib" will be assumed. So my problem is solve. Thanks for you all. Have a nice day.
You are welcome. I'm glad you solved the problem. Yes, I should've guessed an issue, since it was missing symbols from Qt 4.5, on which QtD is based on. And it worked with version from google-code, because it was using Qt 4.4.
Oct 30 2009
prev sibling parent reply Qian Xu <qian.xu stud.tu-ilmenau.de> writes:
Eldar Insafutdinov wrote:
 
 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.
Because the demo project uses QApplication and QMainWindow, which belong to libQtGui.
Oct 30 2009
parent Eldar Insafutdinov <e.insafutdinov gmail.com> writes:
Qian Xu Wrote:

 Eldar Insafutdinov wrote:
 
 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.
Because the demo project uses QApplication and QMainWindow, which belong to libQtGui.
Yes it does. Can you post the exact command line that you use when building an example?
Oct 30 2009