why?

bash-2.05b$
bash-2.05b$
bash-2.05b$ make
g++ -o p8 .obj/occView.o .obj/document.o .obj/main.o .obj/MakeBottle.o .obj/appwindow.o .obj/qmake_image_collection.o .obj/moc_occView.o .obj/moc_appwindow.o -Wl,-rpath,/usr/lib/qt/lib -L/usr/lib/qt/lib -L/usr/X11R6/lib -L/opt/OpenCASCADE5.1/ros/lin/lib/ -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 -lqt-mt -lXext -lX11 -lm
.obj/occView.o(.text+0x148): In function `occView::occView[not-in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x1bc): In function `occView::occView[not-in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x1cf): In function `occView::occView[not-in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x1dd): In function `occView::occView[not-in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_V3d_View::~Handle_V3d_View [in-charge]()'
.obj/occView.o(.text+0x2fc): In function `occView::occView[in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x370): In function `occView::occView[in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x383): In function `occView::occView[in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x391): In function `occView::occView[in-charge](document*, QWidget*, char const*, bool, unsigned)':
: undefined reference to `Handle_V3d_View::~Handle_V3d_View [in-charge]()'
.obj/occView.o(.text+0x3c7): In function `occView::~occView [not-in-charge]()':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x3d5): In function `occView::~occView [not-in-charge]()':
: undefined reference to `Handle_V3d_View::~Handle_V3d_View [in-charge]()'
.obj/occView.o(.text+0x40b): In function `occView::~occView [in-charge]()':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x419): In function `occView::~occView [in-charge]()':
: undefined reference to `Handle_V3d_View::~Handle_V3d_View [in-charge]()'
.obj/occView.o(.text+0x44f): In function `occView::~occView [in-charge deleting]()':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
.obj/occView.o(.text+0x45d): In function `occView::~occView [in-charge deleting]()':
: undefined reference to `Handle_V3d_View::~Handle_V3d_View [in-charge]()'
.obj/occView.o(.text+0x52f): In function `occView::draw()':
: undefined reference to `V3d_View::Redraw() const'
.obj/occView.o(.text+0x57a): In function `occView::initView()':
: undefined reference to `V3d_Viewer::CreateView()'
.obj/occView.o(.text+0x5c8): In function `occView::initView()':
: undefined reference to `Handle_V3d_View::~Handle_V3d_View [in-charge]()'
.obj/occView.o(.text+0x62d): In function `occView::initView()':
: undefined reference to `Viewer_Viewer::Device() const'

Mikael Aronsson's picture

Hi !

I don't have a clue but check the order you put the libraries in, the gcc linker is picky about the order of all libraries, any references to a library must be ahead of the implementing library.

Mikael

Alexandr's picture

Thanks. But look at it:

iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/3.2.2/specs
Configured with: ../gcc-3.2.2/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i386-slackware-linux --host=i386-slackware-linux
Thread model: posix
gcc version 3.2.2
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ ls -l
итого 8
-rw-r--r-- 1 iab root 135 Мар 9 19:58 tttt1.cpp
-rw-r--r-- 1 iab root 91 Мар 9 19:50 tttt.cpp
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ cat tttt.cpp
#include

#include

main()
{
cout << "hi\n";
}
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ cat tttt1.cpp
#include

#include

main()
{
Handle(AIS_InteractiveContext) myContext;

cout << "hi\n";
}
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ g++ tttt.cpp -o tttt -I/opt/OpenCASCADE5.1/ros/inc/ -Wl,-rpath,/usr/lib/qt/lib -L/usr/lib/qt/lib -L/usr/X11R6/lib -L/opt/OpenCASCADE5.1/ros/lin/lib/ -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 -lqt-mt -lXext -lX11 -lm
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
from /opt/OpenCASCADE5.1/ros/inc/Standard_Stream.hxx:4,
from /opt/OpenCASCADE5.1/ros/inc/Standard_TypeDef.hxx:22,
from /opt/OpenCASCADE5.1/ros/inc/Standard_Address.hxx:16,
from /opt/OpenCASCADE5.1/ros/inc/Standard.hxx:28,
from /opt/OpenCASCADE5.1/ros/inc/AIS_InteractiveContext.hxx:20,
from tttt.cpp:1:
/usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ ls -l
итого 24
-rwxr-xr-x 1 iab root 13639 Мар 9 20:00 tttt*
-rw-r--r-- 1 iab root 135 Мар 9 19:58 tttt1.cpp
-rw-r--r-- 1 iab root 91 Мар 9 19:50 tttt.cpp
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ ./tttt
hi
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$
iab@sashok:~/my/esch/qt&oc/88/tttt$ g++ tttt1.cpp -o tttt1 -I/opt/OpenCASCADE5.1/ros/inc/ -Wl,-rpath,/usr/lib/qt/lib -L/usr/lib/qt/lib -L/usr/X11R6/lib -L/opt/OpenCASCADE5.1/ros/lin/lib/ -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 -lqt-mt -lXext -lX11 -lm
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
from /opt/OpenCASCADE5.1/ros/inc/Standard_Stream.hxx:4,
from /opt/OpenCASCADE5.1/ros/inc/Standard_TypeDef.hxx:22,
from /opt/OpenCASCADE5.1/ros/inc/Standard_Address.hxx:16,
from /opt/OpenCASCADE5.1/ros/inc/Standard.hxx:28,
from /opt/OpenCASCADE5.1/ros/inc/AIS_InteractiveContext.hxx:20,
from tttt1.cpp:1:
/usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated.
/tmp/cciz6Qg0.o(.text+0x45): In function `main':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
/tmp/cciz6Qg0.o(.text+0x62): In function `main':
: undefined reference to `Handle_AIS_InteractiveContext::~Handle_AIS_InteractiveContext [in-charge]()'
collect2: ld returned 1 exit status
iab@sashok:~/my/esch/qt&oc/88/tttt$

Mikael Aronsson's picture

This are just warning messages about the old iostream library, this is deprecated but it's just a warning and should work fine, at least as long as you don't try to mix it with new iostream functions.

Mikael

Alexandr's picture

#include "AIS_InteractiveContext.hxx"
#include "iostream.h"

Teresa's picture

Hi, I had the same error... i didn't find answer what is it about and what i did wrong...
but when I write all definitions of my functions in my new class my compile pass :)
so its really simple,but mayby try :)
br
Teresa

vio's picture

I don't know if you solved your problem yet, but any such errors coming from object files mean
1. compilation worked :)
2. you forgot to add some lib in the linking flags (the 'lxxx' type of flags). Simply find what lib has those symbols, and add the flag.
For example, for 'libTKBO.so' you should add '-lTKBO' (lose suffix and replace 'lib' prefix with '-l')
Hope this helps,
Vio