Results 1 to 4 of 4

Thread: Adding glew library

  1. #1
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Adding glew library

    Hi,

    I'm trying to add glew library on my project Qt but I don't understand why, it didn't find some functions.

    Here's my .pro:
    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2011-03-22T23:49:11
    4. #
    5. #-------------------------------------------------
    6.  
    7. QT += core gui opengl
    8. QT += webkit
    9.  
    10. TARGET = Teste
    11. TEMPLATE = app
    12.  
    13.  
    14. SOURCES += main.cpp\
    15. menuprincipal.cpp \
    16. glwidget.cpp \
    17. box.cpp \
    18. point.cpp \
    19. arraylist.cpp \
    20. arraylist.operators.cpp \
    21. xml.cpp \
    22. tinyxmlparser.cpp \
    23. tinyxmlerror.cpp \
    24. tinyxml.cpp \
    25. tinystr.cpp \
    26. robot.cpp \
    27. joint.cpp \
    28. vertex.cpp \
    29. properties.cpp \
    30. face.cpp \
    31. matrixcalculator.cpp
    32.  
    33. HEADERS += menuprincipal.h \
    34. glwidget.h \
    35. box.h \
    36. point.h \
    37. arraylist.h \
    38. xml.h \
    39. tinyxml.h \
    40. tinystr.h \
    41. robot.h \
    42. joint.h \
    43. vertex.h \
    44. properties.h \
    45. face.h \
    46. matrixcalculator.h \
    47. tree.hh
    48.  
    49. FORMS += menuprincipal.ui
    50. LIBS += -lglew32
    To copy to clipboard, switch view to plain text mode 

    I don't have problems calling code = glewInit(); but when I try to call other functions like glGenVertexArrays, I have this error:
    undefined reference to `_imp____glewGenVertexArrays'

    I read the instructions of how to set this library here but nothing. I have put the header <GL/glew.h> in the right place but stills not working.
    Any idea?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Adding glew library

    If the glew library binary is not on the standard linker search path then you also need to add its directory to the LIBS:
    Qt Code:
    1. # Windows
    2. LIBS += -L/path/to/glew/lib -lglew32 -lglu32 -lopengl
    3. # Linux
    4. LIBS += -L/path/to/glew/lib -lGLEW -lGLU -lGL
    To copy to clipboard, switch view to plain text mode 
    For GLEW installed into:
    Qt Code:
    1. /path/to/glew/lib/libGLEW.so
    2. or
    3. /path/to/glew/lib/glew.lib
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Adding glew library

    Still not working:

    I post here more information about the links to libraries:

    This is the message before the error
    mingw32-make[1]: Entering directory `C:/Documents and Settings/anubiola/Desktop/RoKiSim/test/Teste-build-desktop'
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Teste.exe object_script.Teste.Debug -L"c:\QtSDK\Desktop\Qt\4.7.3\mingw\lib" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -lglew32 -lQtWebKitd4 -lQtOpenGLd4 -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib

    As you can see glew32 is linked.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Adding glew library

    As you can see glew32 is linked.
    No, your error message tells you exactly the opposite. You have not linked one or more of those libraries. I can see you have told the linker to use library glu32/glew32 if it can find them but that is clear that they are not found. The -L option I told you about adds to the search path the linker uses to find these libraries.

Similar Threads

  1. Replies: 9
    Last Post: 21st May 2011, 12:54
  2. Adding library in another project
    By Anshuman in forum Qt Programming
    Replies: 1
    Last Post: 26th April 2011, 17:13
  3. Adding a OAuth library to a QT application
    By srohit24 in forum Qt Programming
    Replies: 1
    Last Post: 14th April 2009, 09:33
  4. Adding an external Library
    By afflictedd2 in forum Qt Programming
    Replies: 1
    Last Post: 13th December 2008, 06:51
  5. Adding library dependencies to qmake
    By sadastronaut in forum Installation and Deployment
    Replies: 2
    Last Post: 18th March 2008, 18:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.