QT and my own shared library, undefined reference to ...
Hello,
I have my own shared library and when I compile my C application with flag -lLEICAN (it is my library), there is not problem.
Now I have a QT application, and here there is a problem.
I have compiled QT application with the same flags, but g++ return me a error:
mydialog.cpp:(.text+0x3d1): undefined reference to........
Any advice???
Best regards.
Re: QT and my own shared library, undefined reference to ...
You managed to cut the interesting part out of the error message. Could you paste the .pro file, linker command and the complete error?
Re: QT and my own shared library, undefined reference to ...
OK!!!
app.pro
Quote:
TEMPLATE = app
INCLUDEPATH += .
# Input
HEADERS += global.h mydialog.h mydialog.ui.h taskman.h touchpad.h touchpad.ui.h
SOURCES += main.cpp mydialog.cpp taskman.c touchpad.cpp
Output of compiler
Quote:
john@Linux-D530:~/workspace/RT_QT_v0.2> make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o main.o main.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o mydialog.o mydialog.cpp
gcc -c -pipe -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o taskman.o taskman.c
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o touchpad.o touchpad.cpp
In file included from touchpad.cpp:24:
/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include/qwindowsystem_qws.h:211: warning: ‘typedef’ was ignored in this declaration
/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include/qwindowsystem_qws.h:216: warning: ‘typedef’ was ignored in this declaration
/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/bin/moc mydialog.h -o moc_mydialog.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o moc_mydialog.o moc_mydialog.cpp
/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/bin/moc touchpad.h -o moc_touchpad.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o moc_touchpad.o moc_touchpad.cpp
g++ -m32 -mtune=geode -Wl,-rpath,/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/lib -o RT_QT_v0.2 main.o mydialog.o taskman.o touchpad.o moc_mydialog.o moc_touchpad.o -L/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/lib -lqte -lrt -lLEICIF -lpthread
mydialog.o: In function `MyDialog::CanActivate()':
mydialog.cpp:(.text+0x48a): undefined reference to `LEICANstop(int)'
collect2: ld returned 1 exit status
make: *** [RT_QT_v0.2] Error 1
In taskman.c there is other LEICANstop() function but in this case there is not problem.
In both files, taskman.c and mydialog.cpp there is a inlcude for lib, libLEICIF.h
Thank you
Re: QT and my own shared library, undefined reference to ...
Re: QT and my own shared library, undefined reference to ...
Quote:
Originally Posted by
jpn
Thank you, I am going to read this document.
Best regards