undefined reference to typeinfo 'class name'

Hi forum,

I guess this is one of the most common linking error anyone have ever encountered.
Unfortunately i could not track it and i need your help here. The error i am getting is :

 
../../../lib/libosgOpenCLd.so:-1: error: undefined reference to `typeinfo for osgViewer::GraphicsWindowX11' 


I have included the above reference into my source as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifdef _WIN32
#include <osgViewer/api/Win32/GraphicsWindowWin32>
#elif defined(__GNUC__)
#include <osgViewer/api/X11/GraphicsWindowX11>
#elif defined( __APPLE__)
#include <osgViewer/api/Cocoa/GraphicsWindowCocoa>
#endif
.......................
.......................

bool Context::setupDeviceAndContext(osg::GraphicsContext &ctx)
{
.....................
.....................
      //platform dependent casting for the OpenCL context creation
#ifdef defined(_WIN32)
      osgViewer::GraphicsWindowWin32 *windowsWin = dynamic_cast<osgViewer::GraphicsWindowWin32*>(&ctx);

      if(NULL == windowsWin)
      {
        osg::notify(osg::FATAL) << "Win32 Graphics Window Casting is unsuccessful" << std::endl;
        return false;
      }

      windowsWin->realize();

#elif defined(__GNUC__)
      osgViewer::GraphicsWindowX11 *linuxWin = dynamic_cast<osgViewer::GraphicsWindowX11*>(&ctx);

      if(NULL == linuxWin)
      {
        osg::notify(osg::FATAL) << "X11 Graphics Window Casting is unsuccessful" << std::endl;
        return false;
      }

      //realize the window
      linuxWin->realize();

#elif defined(__APPLE__)
      osgViewer::GraphicsWindowCocoa *osxWin = dynamic_cast<osgViewer::GraphicsWindowCocoa*>(&ctx);

      if(NULL == osxContext)
      {
        osg::notify(osg::FATAL) << "Cocoa Graphics Window Casting is unsuccessful. " << std::endl;
        return false;
      }

      osxWin->realize();
#endif
}

.............................
.............................

       cl_context_properties contextProperties[] =
          {
#ifdef defined(_WIN32)
           CL_CONTEXT_PLATFORM, (cl_context_properties) _m_clPlatform,
           CL_GL_CONTEXT_KHR, (cl_context_properties) windowsWin->getWGLContext(),
           CL_WGL_HDC_KHR, (cl_context_properties) windowsWin->getHDC(),
#elif defined(__GNUC__)
           CL_CONTEXT_PLATFORM, (cl_context_properties) _m_clPlatform,
           CL_GL_CONTEXT_KHR, (cl_context_properties) linuxWin->getContext(),
           CL_GLX_DISPLAY_KHR, (cl_context_properties) linuxWin->getDisplay(),
#elif defined(__APPLE__)
           CGLContextObj glContext = CGLGetCurrentContext(); // get the current GL context
           CGLShareGroupObj shareGroup = CGLGetShareGroup(glContext); // share group

           CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE,
           (cl_context_properties) shareGroup,
#endif
           0
        };
...........................
............................
}


`osgViewer::GraphicsWindowX11' is already a file from another library i am using and the library is already compiled and tested.

Any hint folks?

Thanks
Sajjadul
http://stackoverflow.com/questions/307352/g-undefined-reference-to-typeinfo

By the way, ¿why can''t you simply ctx.realize(); ?
Topic archived. No new replies allowed.