Menu

#214 multiple contexts with C++

1.10.0
closed
None
3
2013-08-23
2013-06-20
No

i'm using glew-1.9.0.

when trying to add multiple window support to my C++ project, i
noticed that the linker would bail out, claiming that a lot of
__glewX... (e.g. __glewXCushionSGI) things have beem multiply defined.

  • those "things" are function-pointers (that is: named variables
    pointing to a function)
  • my project consists of multiple C++ files
  • for various reasons i'm including the file "glxew.h" in multiple
    C++-files
  • when compiling with GLEW_MX, the macro GLXEW_FUN_EXPORT expands to
    nothing, whereas when compiling without multicontext support, it
    expands to GLEW_FUN_EXPORT which expands to "extern ... "
  • therefore, when using GLEW_MX, i get multiple definitions of those
    variables.

this only happens in C++, C is fine.

see attached example. (edit the Makefile to compile with glew vs
glew-mx; rename the .cpp files to .c to verify that it works with C)

changing the definition of GLXEW_FUN_EXPORT to GLEW_FUN_EXPORT
regardless of the GLEW_MX state, seems to fix the problem for me.

1 Attachments

Discussion

  • Nigel Stewart

    Nigel Stewart - 2013-07-12
    • assigned_to: Nigel Stewart
    • Group: v1.0_(example) --> 1.9.1
    • Priority: 1 --> 4
     
  • Nigel Stewart

    Nigel Stewart - 2013-07-12
    • status: open --> pending
    • Priority: 4 --> 3
     
  • Nigel Stewart

    Nigel Stewart - 2013-07-12

    Thanks for the reproducer, very helpful.

    For Ubuntu 12.04, it works fine for me in both modes.
    (with libglew1.6-dev installed)

    $ make
    g++ -I. -DGLEW_MX -I/usr/include/GL     -c -o main.o main.cpp
    g++ -I. -DGLEW_MX -I/usr/include/GL     -c -o render.o render.cpp
    g++ -o glewtest main.o render.o -lGLEWmx -lGLU -lGL    -L/usr/X11R6/lib -lXxf86vm -lX11
    

    However, using the tarballs I can confirm:

    1.7.0 - OK
    1.8.0 - broken
    1.9.0 - broken
    1.10.0 - OK (in progress)

    Would you mind trying this snapshot to see if this problem is resolved
    for you too?

    http://sourceforge.net/projects/glew/files/glew/snapshots/glew-20130318.tgz/download

    • Nigel
     
    • IOhannes m zmölnig

      sorry for not being able to reply earlier. i now tried the 0.10.0 release, and indeed it seems that the problem is gone. thanks for fixing!

       
  • Nigel Stewart

    Nigel Stewart - 2013-07-22
    • status: pending --> closed
     
  • Nigel Stewart

    Nigel Stewart - 2013-07-22

    Fixed in GLEW 1.10.0
    Closing.
    Thanks for the report.

     
MongoDB Logo MongoDB