title: Undefined symbols for architecture x86_64:"_glutInit", referenced from:_main in main.o / Netbeans on Mac
body: <p>My program is this Sierpinski Gasket.  I'm using Netbeans on my MacBook Pro and I believe I have the libraries installed but maybe they are not linked correctly.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;OpenGL/gl.h&gt;
  #include &lt;OpenGL/glu.h&gt;
  #include &lt;GLUT/glut.h&gt;
  #include &lt;OpenGL/glext.h&gt;
  
  void myinit(){
      glClearColor(1.0,1.0,1.0,1.0);
      glColor3f(1.0,0.0,0.0);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluOrtho2D(0.0,50.0,0.0,50.0);
      glMatrixMode(GL_MODELVIEW);
  }
  
  void display(){
      GLfloat vertices[3][2]={{0.0,0.0},{25.0,50.0},{50.0,0.0}};
      int i, j, k;
      int rand();
      GLfloat p[2]={7.5,5.0};
      glClear(GL_COLOR_BUFFER_BIT);
      glBegin(GL_POINTS);
  
      for(k=0; k&lt;5000; k++){
          j=rand()*3;
          p[0]=(p[0]+vertices[j][0])/2.0;
          p[1]=(p[1]+vertices[j][1])/2.0;
          glVertex2fv(p);
      }
  
      glEnd();
      glFlush();
  }
  
  
  int main(int argc, char** argv) {
      glutInit(&amp;argc,argv);
      glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
      glutInitWindowSize(500,500);
      glutInitWindowPosition(0,0);
      glutCreateWindow(&quot;Sierpinski Gasket&quot;);
      glutDisplayFunc(display);
      myinit();
      glutMainLoop();
  }
  </code></pre>
  <p>Here are the compilation errors:</p>
  <pre class="lang-none prettyprint-override"><code>Undefined symbols for architecture x86_64:
    &quot;_glutInit&quot;, referenced from:
        _main in main.o
    &quot;_glutInitDisplayMode&quot;, referenced from:
        _main in main.o
    &quot;_glutInitWindowSize&quot;, referenced from:
        _main in main.o
    &quot;_glutInitWindowPosition&quot;, referenced from:
        _main in main.o
    &quot;_glutCreateWindow&quot;, referenced from:
        _main in main.o
    &quot;_glutDisplayFunc&quot;, referenced from:
        _main in main.o
    &quot;_glutMainLoop&quot;, referenced from:
        _main in main.o
  ld: symbol(s) not found for architecture x86_64
  collect2: ld returned 1 exit status
  make[2]: *** [dist/Debug/GNU-MacOSX/sierpinski] Error 1
  make[1]: *** [.build-conf] Error 2
  make: *** [.build-impl] Error 2
  </code></pre>