Building Qt Sample

Hi,

I'm new to Open Cascade and somewhat new to linux. I've installed OC on Ubuntu 10.04 LTS - Lucid Lynx. When I try to build the Qt-Sample , I get an undefined reference to V3d_view::Dump. See the build log below. Has anyone an idea how to solve this? I'm attaching the Makefile, too.

Thanks
Marvin

Starte "/usr/bin/make" -w
make: Gehe in Verzeichnis '/opt/opencascade/samples/qt/tutorial'
/usr/bin/make -f Makefile.Release
make[1]: Betrete Verzeichnis '/opt/opencascade/samples/qt/tutorial'
g++ -Wl,-O1 -o Linux/bin/Tutorial Linux/obj/ApplicationCommon.o Linux/obj/ApplicationTut.o Linux/obj/DocumentCommon.o Linux/obj/DocumentTut.o Linux/obj/Main.o Linux/obj/MakeBottle.o Linux/obj/Material.o Linux/obj/MDIWindow.o Linux/obj/Transparency.o Linux/obj/View.o Linux/obj/moc_ApplicationCommon.o Linux/obj/moc_ApplicationTut.o Linux/obj/moc_DocumentCommon.o Linux/obj/moc_DocumentTut.o Linux/obj/moc_Material.o Linux/obj/moc_MDIWindow.o Linux/obj/moc_Transparency.o Linux/obj/moc_View.o -L/usr/lib -L/opt/opencascade/ros/Linux/lib -L/usr/X11R6/lib -lXext -lX11 -lm -lGLU -lGL -lTKernel -lPTKernel -lTKMath -lTKService -lTKV3d -lTKV2d -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 -lTKSTEPBase -lTKShapeSchema -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d -lTKXSBase -lTKPShape -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -L/usr/share/qt4/lib -lQtGui -lQtCore -lpthread
Linux/obj/MakeBottle.o: In function `BRepOffsetAPI_MakeOffsetShape::~BRepOffsetAPI_MakeOffsetShape()':
MakeBottle.cxx:(.text._ZN29BRepOffsetAPI_MakeOffsetShapeD2Ev[BRepOffsetAPI_MakeOffsetShape::~BRepOffsetAPI_MakeOffsetShape()]+0xe1): undefined reference to `TopTools_DataMapOfShapeReal::Clear()'
make[1]: Verlasse Verzeichnis '/opt/opencascade/samples/qt/tutorial'
make: Verlasse Verzeichnis '/opt/opencascade/samples/qt/tutorial'
MakeBottle.cxx:(.text._ZN29BRepOffsetAPI_MakeOffsetShapeD2Ev[BRepOffsetAPI_MakeOffsetShape::~BRepOffsetAPI_MakeOffsetShape()]+0x164): undefined reference to `TopTools_DataMapOfShapeReal::Clear()'
Linux/obj/View.o: In function `View::dump(char const*)':
View.cxx:(.text+0x1696): undefined reference to `V3d_View::Dump(char const*, Image_TypeOfImage)'
collect2: ld returned 1 exit status
make[1]: *** [Linux/bin/Tutorial] Fehler 1
make: *** [release] Fehler 2
Der Prozess "/usr/bin/make" wurde mit dem Rückgabewert 2 beendet.

Attachments: 
Fabian Hachenberg's picture

Try to move -lTKV3d to the back of your commandline
Remember: If you have code in library A which is referencing a function in library B, you have to pass A prior to B to the linker.

http://www.network-theory.co.uk/docs/gccintro/gccintro_18.html

purkey's picture

Hi Fabian,

thanks for your answer and the link. I'm not at the office until friday or monday. I will post the result of your suggestion as soon as I am back.

Regards
Marvin

purkey's picture

Hi,

I've changed the order of the libraries and the last error message disappeared. But I still have those below.

I have also moved -lTKBRep in front of -lTKTopAlgo (what I guess is the library containing TopTools_DataMapOfShapeReal::Clear()).

Regards
Marvin

make: Gehe in Verzeichnis '/opt/opencascade/samples/qt/tutorial'
/usr/bin/make -f Makefile.Release
make[1]: Betrete Verzeichnis '/opt/opencascade/samples/qt/tutorial'
g++ -Wl,-O1 -o Linux/bin/Tutorial Linux/obj/ApplicationCommon.o Linux/obj/ApplicationTut.o Linux/obj/DocumentCommon.o Linux/obj/DocumentTut.o Linux/obj/Main.o Linux/obj/MakeBottle.o Linux/obj/Material.o Linux/obj/MDIWindow.o Linux/obj/Transparency.o Linux/obj/View.o Linux/obj/moc_ApplicationCommon.o Linux/obj/moc_ApplicationTut.o Linux/obj/moc_DocumentCommon.o Linux/obj/moc_DocumentTut.o Linux/obj/moc_Material.o Linux/obj/moc_MDIWindow.o Linux/obj/moc_Transparency.o Linux/obj/moc_View.o -L/usr/lib -L/opt/opencascade/ros/Linux/lib -L/usr/X11R6/lib -L/usr/lib -L/usr/local/lib -lTKBRep -lXext -lX11 -lm -lGLU -lGL -lTKernel -lPTKernel -lTKMath -lTKService -lTKV3d -lTKV2d -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209 -lTKSTEPBase -lTKShapeSchema -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d -lTKXSBase -lTKPShape -lTKShHealing -lTKHLR -lTKMesh -lTKPrim -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -L/usr/share/qt4/lib -lTKTopAlgo -lQtGui -lQtCore -lpthread
Linux/obj/MakeBottle.o: In function `BRepOffsetAPI_MakeOffsetShape::~BRepOffsetAPI_MakeOffsetShape()':
make[1]: Verlasse Verzeichnis '/opt/opencascade/samples/qt/tutorial'
make: Verlasse Verzeichnis '/opt/opencascade/samples/qt/tutorial'
MakeBottle.cxx:(.text._ZN29BRepOffsetAPI_MakeOffsetShapeD2Ev[BRepOffsetAPI_MakeOffsetShape::~BRepOffsetAPI_MakeOffsetShape()]+0xe1): undefined reference to `TopTools_DataMapOfShapeReal::Clear()'
MakeBottle.cxx:(.text._ZN29BRepOffsetAPI_MakeOffsetShapeD2Ev[BRepOffsetAPI_MakeOffsetShape::~BRepOffsetAPI_MakeOffsetShape()]+0x164): undefined reference to `TopTools_DataMapOfShapeReal::Clear()'
collect2: ld returned 1 exit status
make[1]: *** [Linux/bin/Tutorial] Fehler 1
make: *** [release] Fehler 2
Der Prozess "/usr/bin/make" wurde mit dem Rückgabewert 2 beendet.

purkey's picture

Well, I have now removed all of OCC on my machine, reinstalled it via software center (and not by downloading package and compiling it by myself), then it didn't work neither, then I downloaded FreeCad and then, somehow, I could compile the sample without errors.

Regards
Marvin