1

I can't link glew with Code::Blocks. I can't compile with even easy code. Many errors likeundefined reference to 'glewInit'.

I have glew library is located in /usr/include/GL/glew.h.

From here, i guess i ought to link as follows: -L/usr/local/lib -lglfw3 -pthread -lGLEW -lGLU -lGL -lrt -lXrandr -lXxf86vm -lXi -lXinerama -lX11, but i don't know how to do this in Code::Blocks.

Code:

#ifdef __APPLE__
#include <GL/glew.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#include <GLM/glm.hpp>
#else
#include "GL/glew.h"
#include "GL/glut.h"
#endif

#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate,    glm::rotate, glm::scale, glm::perspective
#include <math.h>

Here is a screenshot of currently linked library:

Here is a screenshot of currently linked library:

Community
  • 1
  • 1
ytutow
  • 285
  • 1
  • 4
  • 13

1 Answers1

2

You need to specify the linker search path. Below is a picture done on windows platform, but I believe you will be able to adjust easily to your needs:

enter image description here

Now, just include your library, as usual:

enter image description here

and add GLEW to this list (removing, of course, what you dont need)

Community
  • 1
  • 1
Amadeus
  • 10,199
  • 3
  • 25
  • 31
  • Thank you! specify the linker search path works for me, besides, add these library to "other linker options" also works. – ytutow Jan 02 '17 at 15:07