[Qt-interest] QTcpSocket and the shared library

Salama, Yassir - AES Yassir.Salama at itt.com
Wed Nov 25 18:31:05 CET 2009


Hi,
I'm trying to build a shared library with a program that uses QTcpSocket. I was able to successfully build the application as a full executable application with main.cpp
But, when I try to build a shared library module, I get error messages that basically says none of the QTcpSocket (or QAbstractSocket) are defined. Here is a piece of the linker output:

Linking CXX shared library lib/libEDGI.so
CMakeFiles/EDGI.dir/edgeDialog.o: In function `edgeDialog::okButtonClicked()':
/home/yassir/tst/QtExamples/Designer/jbi_if/edgeDialog.cpp:50: undefined reference to `QTcpSocket::QTcpSocket(QObject*)'
/home/yassir/tst/QtExamples/Designer/jbi_if/edgeDialog.cpp:51: undefined reference to `QAbstractSocket::abort()'
/home/yassir/tst/QtExamples/Designer/jbi_if/edgeDialog.cpp:52: undefined reference to `QAbstractSocket::connectToHost(QString const&, unsigned short, QFlags<QIODevice::OpenModeFlag>)'
/home/yassir/tst/QtExamples/Designer/jbi_if/edgeDialog.cpp:53: undefined reference to `QAbstractSocket::waitForConnected(int)'
/home/yassir/tst/QtExamples/Designer/jbi_if/edgeDialog.cpp:59: undefined reference to `QAbstractSocket::flush()'
collect2: ld returned 1 exit status
make[2]: *** [lib/libEDGI.so.4.2.0] Error 1
make[1]: *** [CMakeFiles/EDGI.dir/all] Error 2
make: *** [all] Error 2

And here is the list of the linker options

inking CXX shared library lib/libEDGI.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/EDGI.dir/link.txt --verbose=1
/usr/bin/c++  -fPIC  -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -fvisibility-inlines-hidden -O2 -g -Wl,--enable-new-dtags -Wl,--fatal-warnings -Wl,--no-undefined -lc -shared -Wl,-soname,libEDGI.so.4.2.0 -o lib/libEDGI.so.4.2.0 CMakeFiles/EDGI.dir/EDGI_automoc.o CMakeFiles/EDGI.dir/edgeDialog.o /usr/lib/libkdeui.so.5.2.0 /usr/lib/libkdecore.so.5.2.0 -lQtDBus -lQtCore -lQtSvg -lQtGui -Wl,-rpath,::::::::::::::

The linker uses the following libraries:
libkdeui.so.5.2.0
libkdecore.so.5.2.0
QtDBus
QtCore QtSvg
QtGui

The same list of libraries are used in the application program that has main.cpp

Can anyone help on this?

-- newUser

This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender.
Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.




More information about the Qt-interest-old mailing list