Cannot compile tutorial with qt

Hello,
After I got to compile OCC for Linux with g++-3, I then tried to compile tutorial with qt-3 and then qt-2. With qt-3 the compilation fail with tried to compile each file. When I went with qt-2, compilation of object files went ok, but it failed when trying to link all the object files into binary. Numerous errors are displayed, such as shown below.
I would be grateful if anyone could suggest or point out what I could do to get it to work. Or if anyone has a binary version of the tutorial for Linux I could tried runing.

Thank you much,
Worawut

/**********************************************************/
g++ ../../Linux/obj/Application.o ../../Linux/obj/Document.o ../../Linux/obj/Mai
n.o ../../Linux/obj/MDIWindow.o ../../Linux/obj/Material.o ../../Linux/obj/Trans
parency.o ../../Linux/obj/View.o ../../Linux/obj/MakeBottle.o ../../Linux/obj/mo
c_Application.o ../../Linux/obj/moc_Document.o ../../Linux/obj/moc_MDIWindow.o .
./../Linux/obj/moc_Material.o ../../Linux/obj/moc_Transparency.o ../../Linux/obj
/moc_View.o -o ../../Linux/bin/Tutorial -L/opt/OCC-50/ros/Linux/lib -L/usr/lib/
qt-2.3.1/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -lm -ldl -lc -lX11 -lXext -lXmu
-lGL -lGLU -lqt -lpthread -lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBR
ep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lT
KHLR -lTKService -lTKV2d -lTKV3d -lTKPCAF -lTKCDF -lTKCAF -lPTKernel -lTKIGES -l
TKSTEP -lTKSTL -lTKVRML -lTKShHealing -lTKXSBase -lTKPShape -lTKShapeSchema -lTK
OpenGl -lTKBO -lTKBool -lTKTopAlgo -lTKPrim -lTKOffset -lTKFillet -lTKBO
../../Linux/obj/Application.o: In function `ApplicationWindow::ApplicationWindow
[not-in-charge]()':
../../Linux/obj/Application.o(.text+0x14): undefined reference to `QMainWindow::
QMainWindow[not-in-charge](QWidget*, char const*, unsigned)'
../../Linux/obj/Application.o(.text+0xed): undefined reference to `QVBox::QVBox[
in-charge](QWidget*, char const*, unsigned)'
../../Linux/obj/Application.o(.text+0x175): undefined reference to `QWorkspace::
QWorkspace[in-charge](QWidget*, char const*)'
../../Linux/obj/Application.o(.text+0x1d0): undefined reference to `QMainWindow:
:setCentralWidget(QWidget*)'
...
collect2: ld returned 1 exit status
make[1]: *** [../../Linux/bin/Tutorial] Error 1
make[1]: Leaving directory `/opt/OCC-50/samples/tutorial/adm/Linux'
make: *** [all] Error 2

MCV's picture

Did you call the ./configure scripts ? They turn out a useful Makefile, that you can call via "make" afterwards, and it should work fine.

Maybe, you should check again all compiler-flags and the included Libraries "-I..." for you gcc-command.

maybe this helps you, for single application, no tutorials, I use this script:

#!/bin/bash
CC=cc
CXX=g++
MOC=/usr/lib/qt2//bin/moc
MSG2QM=/usr/lib/qt2//bin/msg2qm

X_INCLUDES=-I/usr/X11R6/include
GL_INCLUDES=-I/usr/include
QT_INCLUDES=-I/usr/lib/qt2/include
OCC_INCLUDES=-I/opt/OpenCASCADE-50/ros/inc

X_LDFLAGS=-L/usr/X11R6/lib
GL_LDFLAGS=-L/usr/lib
QT_LDFLAGS=-L/usr/lib/qt2/lib
OCC_LDFLAGS=-L/opt/OpenCASCADE-50/ros/Linux/lib

LIB_X="-lX11 -lXext -lXmu"
LIB_GL="-lGL -lGLU"
LIB_QT="-lqt -lpthread"
LIB_OCC="-lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lTKHLR -lTKService -lTKV2d -lTKV3d -lTKPCAF -lTKCDF -lTKCAF -lPTKernel -lTKIGES -lTKSTEP -lTKSTL -lTKVRML -lTKShHealing -lTKXSBase -lTKPShape -lTKShapeSchema -lTKOpenGl -lTKBO -lTKBool -lTKTopAlgo -lTKPrim -lTKOffset -lTKFillet -lTKBO"

CFLAGS="-DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception -DLIN -DLININTEL"
CXXFLAGS="-DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception -DLIN -DLININTEL"
LDFLAGS=-L/usr/X11R6/lib
LIBS="-lm -ldl -lc"

g++ $CXXLAGGS $X_INCLUDES $GL_INCLUDES $QT_INCLUDES $OCC_INCLUDES $LDFLAGS $X_LDFLAGS $QT_LDFLAGS $GL_DFLAGS $OCC_LDFLAGS $LIBS $LIB_X $LIB_QT $LIB_OCC $LIB_GL -o $1 $1.cc

Watch out, this is being used for gcc-2.95.3 and do not forget to set the executable-flag for the script: chmod +x yourScriptName

Good luck.

MCV