Compiling openGL file

I am trying to compile the file triangle.cpp from:
http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Introduction
This is the output I get:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Undefined symbols for architecture x86_64:
  "_glewGetErrorString", referenced from:
      _main in triangle-763e45.o
  "_glewInit", referenced from:
      _main in triangle-763e45.o
  "_glutCreateWindow", referenced from:
      _main in triangle-763e45.o
  "_glutDisplayFunc", referenced from:
      _main in triangle-763e45.o
  "_glutInit", referenced from:
      _main in triangle-763e45.o
  "_glutInitContextVersion", referenced from:
      _main in triangle-763e45.o
  "_glutInitDisplayMode", referenced from:
      _main in triangle-763e45.o
  "_glutInitWindowSize", referenced from:
      _main in triangle-763e45.o
  "_glutMainLoop", referenced from:
      _main in triangle-763e45.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


What do I have to do to compile this file? I do have the files freeglut.h and glew.h in the directory GL.
Make sure you are linking properly to the library files.

Aceix.
I am now compiling with:
g++ -framework GLUT -framework OpenGL -framework Cocoa triangle.cpp -o triangle

Now the output is reduced to

1
2
3
4
5
6
7
8
Undefined symbols for architecture x86_64:
  "_glewGetErrorString", referenced from:
      _main in triangle-d85427.o
  "_glewInit", referenced from:
      _main in triangle-d85427.o
  "_glutInitContextVersion", referenced from:
      _main in triangle-d85427.o
ld: symbol(s) not found for architecture x86_64

How can I omit these 'errors' also?
Last edited on
Topic archived. No new replies allowed.