occ 6.2.0 : linking errors with g++ / ld

Hi all,

I've just reinstall OpenCascade 6.2.0 on my KUbuntu 8.04 laptop, and try recompile some of my projects.

I've also switched to Qt 4.3.4 (and so for qmake), and g++ 4.2.3.
I get linking erros when rebuilding my shared libraries that rely on OpenCascade, for example :
"undefined reference to `Viewer_Viewer::Device()"
"undefined reference to `Xw_Window::Xw_Window(Handle_Xw_GraphicDevice const&, int, int, Xw_WindowQuality, Quantity_NameOfColor)'"

Of course I specify -lTKV3d, ... to the linker.

I tried to removed the option --no-undefined (I know that's a bad idea) from the linker parameters and then it links and execute just fine.

I am not an expert with shared libraries on Linux systems, but it seems OpenCascade lacks "import libraries" stuff, like for Windows DLL ? I've read somewhere ldconfig has to called on shared libraries to install them.

What is your opinion about that ? Do all you link your OpenCascade-based projects with the --no-undefined option ?

Note : I did not remember if --no-undefined was used when I was working with KUbuntu 7.10 and it official Qt and gcc packages (version 4.3.2 and 4.2.1 I think).

Thanks a lot for your responses !

Hugues Delorme's picture

My fault !!!

I forgot to specifiy library TKService !
Everything is OK now. Thanks to Bearloga in thread http://www.opencascade.org/org/forum/thread_13355/
He gives a very useful way to know the packages to link against.