1

Thing is, I am trying to compile simple C++/OpenGL code and no matter what I keep getting this from compiler:

/tmp/ccU7u7eO.o: In function `main':
main.cpp:(.text+0x55): undefined reference to `initGL()'
main.cpp:(.text+0x72): undefined reference to `loadMedia()'
main.cpp:(.text+0x8f): undefined reference to `handleKeys(unsigned char, int, int)'
main.cpp:(.text+0x99): undefined reference to `render()'

and I compile it with these: g++ main.cpp -o test -lGLEW -lGLU -lGL -lglut

genpfault
  • 51,148
  • 11
  • 85
  • 139
Nixx
  • 45
  • 8
  • Have you tried enabling experimental mode for GLEW? I don't think initGL nor handleKeys are GL functions, if they're your functions perhaps you might want to check if you've defined them first. – Poriferous Jan 23 '15 at 20:55

1 Answers1

0

The error Undefined reference to 'x' just means the compiler cannot find a symbol by that name.

Common causes include:

  • Missing a library
  • Forgot to include a file in your compiler / linker command if you have multiple source files in the project.
  • A typo / misspelling of a function name, e.g. you typed initGL when you really meant InitGL.

This is the best I can do without you posting the rest of your code.

Brian McFarland
  • 9,052
  • 6
  • 38
  • 56