Linker error: undefined reference to `GLUI_Master'

1.4k views Asked by At

This is my first post. (Sorry if I missed something.)

(In C++, Dev-C++ IDE)

So, I made a gl/glu/glut project, and had no problems/errors, right? After that, I added the header

#include <gl/glui.h>

And compiled. Still no errors.

Following that, I actually added some GLUI code, mostly in my main function. This is that main function:

int main(int argc, char** argv) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowSize(512, 512);
  glutCreateWindow("Testing GL");
  initRendering(); 

  glutDisplayFunc(drawScene);
  glutKeyboardFunc(handleKeypress);
  glutSpecialFunc(handleSpecial);
  glutReshapeFunc(handleResize);

  GLUI *glui = GLUI_Master.create_glui( "GLUI" );
  glui->add_checkbox( "Wireframe", &wireframe );
  GLUI_Spinner *segment_spinner =
    glui->add_spinner( "Segments:", GLUI_SPINNER_INT, &segments );
  segment_spinner->set_int_limits( 3, 60 );

  glui->set_main_gfx_window( main_window );*/

  GLUI_Master.set_glutIdleFunc( GlutIdle );
  glutMainLoop();
  return 0;
}

I then compiled it. There were many errors!

[Linker error] undefined reference to `GLUI_Master' 
[Linker error] undefined reference to `GLUI_Master_Object::create_glui(char const*, long, int, int)' 
[Linker error] undefined reference to `GLUI::add_checkbox(char const*, int*, int, GLUI_CB)' 
...

... and many more that appeared very similar.

I don't know what I did wrong. I researched my problem (Google) and found, actually, a ton of questions similar to this one. They were left unanswered! I would appreciate any help fixing these errors.

1

There are 1 answers

1
foobar On BEST ANSWER

I guess you need to add this #pragma comment(lib, "glui32.lib")