PDA

View Full Version : building non-qt project with qmake



sajis997
23rd February 2013, 08:07
Hi

I am using the qmake to build project which no connection with qt . I am creating a static library with some common files which will be used by the application very frequently. The static library is created , but i am getting the following linking error while compiling the application that uses the static library.



sajjad@sajjad-G74Sx:~/Documents/OpenSceneGraph/practicebook/cookbook$ make clean && make
cd common/ && make -f Makefile clean
make[1]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
make -f Makefile.Release clean
make[2]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
rm -f release/CommonFunctions.o
rm -f *~ core *.core
make[2]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
make -f Makefile.Debug clean
make[2]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
rm -f debug/CommonFunctions.o
rm -f *~ core *.core
make[2]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
make[1]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
cd ObserverPointer/ && make -f Makefile clean
make[1]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/ObserverPointer'
/usr/bin/qmake -o Makefile ObserverPointer.pro
make[1]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/ObserverPointer'
make[1]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/ObserverPointer'
rm -f main.o
rm -f *~ core *.core
make[1]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/ObserverPointer'
cd common/ && make -f Makefile
make[1]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
make -f Makefile.Release
make[2]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
g++ -c -pipe -O2 -fPIC -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I/usr/include/osg -I/usr/include/osgAnimation -I/usr/include/osgDB -I/usr/include/osgGA -I/usr/include/osgManipulator -I/usr/include/osgViewer -I/usr/include/osgUtil -IBuild/common/Release -o release/CommonFunctions.o CommonFunctions.cpp
rm -f libcommon.a
ar cqs libcommon.a release/CommonFunctions.o
rm -f lib/libcommon.a
mv -f libcommon.a lib/
make[2]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
make[1]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/common'
cd ObserverPointer/ && make -f Makefile
make[1]: Entering directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/ObserverPointer'
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I. -I/usr/include/osg -I/usr/include/osgAnimation -I/usr/include/osgDB -I/usr/include/osgGA -I/usr/include/osgManipulator -I/usr/include/osgViewer -I/usr/include/osgUtil -I/home/sajjad/Downloads/OpenSceneGraph/OpenSceneGraph-Data-3.0.0 -I../common -I. -o main.o main.cpp
main.cpp:27:18: warning: unused parameter ‘node’ [-Wunused-parameter]
main.cpp:27:18: warning: unused parameter ‘nv’ [-Wunused-parameter]
main.cpp:40:5: warning: unused parameter ‘argc’ [-Wunused-parameter]
main.cpp:40:5: warning: unused parameter ‘argv’ [-Wunused-parameter]
g++ -Wl,-O1 -o ObserverPointer main.o -L../common/lib -L/usr/lib/i386-linux-gnu -losgViewer -losgDB -losgUtil -losg -losgSim -lcommon -lQtCore -lpthread
/usr/bin/ld: /usr/local/lib/libosgViewer.so: undefined reference to symbol 'osgUtil::IntersectionVisitor::IntersectionVisitor (osgUtil::Intersector*, osgUtil::IntersectionVisitor::ReadCallback*)'
/usr/bin/ld: note: 'osgUtil::IntersectionVisitor::IntersectionVisitor (osgUtil::Intersector*, osgUtil::IntersectionVisitor::ReadCallback*)' is defined in DSO /usr/local/lib/libosgUtil.so so try adding it to the linker command line
/usr/local/lib/libosgUtil.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[1]: *** [ObserverPointer] Error 1
make[1]: Leaving directory `/home/sajjad/Documents/OpenSceneGraph/practicebook/cookbook/ObserverPointer'
make: *** [sub-ObserverPointer-make_default-ordered] Error 2




Any hints folks ?


Regards
Sajjad

amleto
23rd February 2013, 13:28
Hints? Sure, try asking in the correct forum
http://www.qtcentre.org/forums/3-Qt-Tools


Also try reading your linker error.


/usr/bin/ld: /usr/local/lib/libosgViewer.so: undefined reference to symbol 'osgUtil::IntersectionVisitor::IntersectionVisitor (osgUtil::Intersector*, osgUtil::IntersectionVisitor::ReadCallback*)'

/usr/bin/ld: note: 'osgUtil::IntersectionVisitor::IntersectionVisitor (osgUtil::Intersector*, osgUtil::IntersectionVisitor::ReadCallback*)' is defined in DSO /usr/local/lib/libosgUtil.so so try adding it to the linker command line