Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Link Error: glew

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    4

    Question Link Error: glew

    Hello,

    IDE: code::blocks 10.05
    compiler: gnu gcc

    code:


    #define GLEW_STATIC
    #include <GL/glew.h>
    #include <GL/freeglut.h>
    #include <GL/glext.h>
    #include <stdlib.h>
    #include <iostream>

    using namespace std;

    enum VAO_IDs {Triangles,NumVAOs};
    enum Buffer_IDs {ArrayBuffer, NumBuffers};
    enum Attrib_IDs {vPosition=0};

    GLuint VAOs[NumVAOs];
    GLuint Buffers[NumBuffers];

    const GLuint NumVertices = 6;

    /* GLUT callback Handlers */

    void resize(int width, int height)
    {

    }

    void display(void)
    {

    }

    void key(unsigned char key, int x, int y)
    {

    }

    void mouse()
    {

    }

    void idle(void)
    {

    }

    void init(void)
    {
    glGenVertexArrays(NumVAOs,VAOs);
    glBindVertexArray(VAOs[Triangles]);

    // GLfloat vertices[NumVertices][2]={
    // {-0.9,-0.9},{0.85,-0.9},{-0.9,0.85},{0.9,-0.85},{0.9,0.9},{-0.85,0.9}
    // };
    }
    /* Program entry point */

    int main(int argc, char **argv)
    {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowSize(640,480);
    glutInitWindowPosition(0,0);
    glutInitContextVersion(4,0);
    glutInitContextProfile(GLUT_CORE_PROFILE);
    glutCreateWindow("scientific");


    GLenum err = glewInit();
    if (GLEW_OK != err)
    {
    /* Problem: glewInit failed, something is seriously wrong. */
    cout << glewGetErrorString(err);

    }

    init();

    glutReshapeFunc(resize);
    glutDisplayFunc(display);
    glutKeyboardFunc(key);

    glutIdleFunc(idle);

    glutMainLoop();

    return EXIT_SUCCESS;
    }

    Error:

    C:...\main.cpp|48|undefined reference to `__glewGenVertexArrays'|
    C:...\main.cpp|49|undefined reference to `__glewBindVertexArray'|



    please help
    Last edited by nice87day; 04-27-2013 at 02:12 AM.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,098
    Check that you have included glew lib correctly

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    4
    hello,

    Project/Build options/Linker settings/Link libraries:

    freeglut
    opengl32
    glu32
    winmm
    gdi32
    ..\..\..\..\..\Program Files\CodeBlocks\MinGW\lib\glew32.lib

    please help!!!
    Last edited by nice87day; 04-27-2013 at 09:52 AM.

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    4
    hello,

    i extend the link-list with:

    ..\..\..\..\..\Windows\System32\glew32.dll

    and it compiles!!!

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2013
    Posts
    4
    hello,

    but when i start the programm i get a application crash!!!!

    help

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,098
    ..\..\..\..\..\Windows\System32\glew32.dll
    This is not a library!

    C:...\main.cpp|48|undefined reference to `__glewGenVertexArrays'|
    Where is this message coming from -it look like a link error?
    ..\..\..\..\..\Program Files\CodeBlocks\MinGW\lib\glew32.lib
    try using an absoulte path rather than a relative path

  7. #7
    Advanced Member Frequent Contributor
    Join Date
    Mar 2009
    Location
    Singapore
    Posts
    800
    You can also try adding this before glewInit
    Code :
    glewExperimental = GL_TRUE;
    GLenum err = glewInit();
    see if this helps.
    Regards,
    Mobeen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •