1

I am in the middle of writing a display function for the window in my OpenGL program. My function looks like this:

void window::display() {
    glClear(GL_COLOR_BUFFER_BIT);
    // Loop to draw all particles here
    glutSwapBuffers();
}

However, when I compile my program I get the following error:

Undefined symbols for architecture x86_64:
  "_glutSwapBuffers", referenced from:
      window::display() in window.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've already gotten this error for using glClear(GL_COLOR_BUFFER_BIT) and was able to fix it by adding the -framework OpenGL flag when compiling. This issue is confusing me because glutSwapBuffers() is a GLUT thing, not an OpenGL thing so I don't know if I could fix it the same way or even how I would do that. Some additional info that may be useful: I am on Mac OSX 10.9.4, I have included "OpenGL/gl.h", "OpenGL/glu.h", and "GLUT/glut.h" in all files that require them, and my makefile looks like this...

COMPILECPP  = g++ -g -O0 -Wall -Wextra -framework OpenGL -std=c++11
CPPSOURCE   = window.cpp main.cpp
EXECBIN     = psys
OBJECTS     = ${CPPSOURCE:.cpp=.o}

all : ${EXECBIN}

${EXECBIN} : ${OBJECTS}
    ${COMPILECPP} -o $@ ${OBJECTS}

%.o : %.cpp
    ${COMPILECPP} -c $<
Braiam
  • 1
  • 11
  • 47
  • 78
Felyner
  • 113
  • 1
  • 1
  • 4

0 Answers0