LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Using KColorButton in QT application by QTCreator : linker error (https://www.linuxquestions.org/questions/linux-software-2/using-kcolorbutton-in-qt-application-by-qtcreator-linker-error-781474/)

thandermax 01-11-2010 09:30 AM

Using KColorButton in QT application by QTCreator : linker error
 
Hi,

I am using OpenSuse 11.2 which I just installed.
I was working on one QT application in OpenSuse 10.3 with few KColorButton in it and it was compiling fine under that dist.


Now after copying the project to 11.2 environment , I can't make the project .
It's now throwing linker error :

Quote:

Starting: /usr/bin/make -w
make: Entering directory `/home/aniruddha/ChatServer'
g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_SQL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtSql -I/usr/include/Qt3Support -I/usr/include -I. -I. -o chatwindow.o chatwindow.cpp
g++ -m64 -o ChatServer main.o chatwindow.o moc_chatwindow.o -L/usr/lib64 -lQt3Support -L/usr/lib64 -pthread -pthread -pthread -pthread -lQtXml -pthread -pthread -pthread -pthread -L/usr/X11R6/lib64 -pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread -lQtSql -pthread -pthread -lQtGui -pthread -lpng -lfreetype -lSM -lICE -pthread -pthread -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfontconfig -lXext -lX11 -lQtNetwork -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
make: Leaving directory `/home/aniruddha/ChatServer'
chatwindow.o: In function `Ui_ChatWindow::setupUi(QMainWindow*)':
/home/aniruddha/ChatServer/ui_chatwindow.h:69: undefined reference to `KColorButton::KColorButton(QWidget*)'
/home/aniruddha/ChatServer/ui_chatwindow.h:73: undefined reference to `KColorButton::setColor(QColor const&)'
collect2: ld returned 1 exit status
make: *** [ChatServer] Error 1
Exited with code 2.
Error while building project ChatServer



I thought there was some problem while porting my application to QT 4.3.2 (current build) .

So I created a demo project using Qt Creator with a KColorButton and I recreated the linker cache , but it also shows same symptom.

Is this Qt build broken ? Or /usr/lib64/kde4/plugins/designer/kdewidgets.so library missing from current linker cache ?



Any other way to fix this issue ?

thandermax 01-11-2010 09:33 AM

Still error !
 
I tried adding
/usr/lib64/kde4/plugins/designer/kdewidgets.so to g++ argument . It compiled fine but throws another linker error while lunching the app :

Quote:


Starting /home/aniruddha/ChatServer/ChatServer...
/home/aniruddha/ChatServer/ChatServer: error while loading shared libraries: kdewidgets.so: cannot open shared object file: No such file or directory

/home/aniruddha/ChatServer/ChatServer exited with code 127
:doh:
:banghead:

thandermax 01-11-2010 09:52 AM

Solved
 
Got it ! :hattip:



Quote:

Originally Posted by thandermax (Post 3822498)
I tried adding
/usr/lib64/kde4/plugins/designer/kdewidgets.so to g++ argument . It compiled fine but throws another linker error while lunching the app :


Starting /home/aniruddha/ChatServer/ChatServer...
/home/aniruddha/ChatServer/ChatServer: error while loading shared libraries: kdewidgets.so: cannot open shared object file: No such file or directory

/home/aniruddha/ChatServer/ChatServer exited with code 127


:doh:
:banghead:


Added the shared library to makefile LIBS variable.
LIBS = $(SUBLIBS) /usr/lib64/kde4/plugins/designer/kdewidgets.so -L/usr/lib64 ... ...


And the problem with not loading the shared library while lunching the application was because of not setting LD_LIBRARY_PATH to point correct shared library path .


Changed LD_LIBRARY_PATH to include /usr/lib64/kde4/plugins/designer also and my application loaded successfully .

Credit goes to An Introduction to GCC - for the GNU compilers gcc and g++


All times are GMT -5. The time now is 11:32 PM.