opengl glfw glew undefined reference

  • Thread starter Thread starter Nyap
  • Start date Start date
  • Views Views 3,389
  • Replies Replies 1

Nyap

HTML Noob
Banned
Joined
Jan 13, 2016
Messages
971
Reaction score
347
Trophies
0
Age
57
Location
That Chaos Site
XP
529
Country
so yeah I was really looking forward to learning opengl until I discovered its a fucking nightmare :wacko:
here's the example code I'm trying to build
Code:
#include <GL/glew.h> // include GLEW and new version of GL on Windows
#include <GLFW/glfw3.h> // GLFW helper library
#include <stdio.h>

int main () {
  // start GL context and O/S window using the GLFW helper library
  if (!glfwInit ()) {
  fprintf (stderr, "ERROR: could not start GLFW3\n");
  return 1;
  }

  // uncomment these lines if on Apple OS X
  /*glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 3);
  glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 2);
  glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
  glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);*/

  GLFWwindow* window = glfwCreateWindow (640, 480, "Hello Triangle", NULL, NULL);
  if (!window) {
  fprintf (stderr, "ERROR: could not open window with GLFW3\n");
  glfwTerminate();
  return 1;
  }
  glfwMakeContextCurrent (window);

  // start GLEW extension handler
  glewExperimental = GL_TRUE;
  glewInit ();

  // get version info
  const GLubyte* renderer = glGetString (GL_RENDERER); // get renderer string
  const GLubyte* version = glGetString (GL_VERSION); // version as a string
  printf ("Renderer: %s\n", renderer);
  printf ("OpenGL version supported %s\n", version);

  // tell GL to only draw onto a pixel if the shape is closer to the viewer
  glEnable (GL_DEPTH_TEST); // enable depth-testing
  glDepthFunc (GL_LESS); // depth-testing interprets a smaller value as "closer"

  /* OTHER STUFF GOES HERE NEXT */

  // close GL context and any other GLFW resources
  glfwTerminate();
  return 0;
}
and here's the command I'm using
g++-6 -o demo main.cpp /usr/lib64/libGLEW.a /usr/local/lib/libglfw3.a -I include -lGL -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lm
output:
/usr/bin/ld: /usr/local/lib/libglfw3.a(vulkan.c.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
plz help
edit: I just tried compiling the examples that come with GLFW using the included makefile and it works fine
 
Last edited by Nyap,
man pppppppplllllllllllzzzzzzz these demos are so cool why did I have to get stuck like right at the start
84KYdad.png
 

Site & Scene News

Popular threads in this forum