1

I'm trying to run this .cpp file in Codeblocks (only change is adding #include for windows.h to beginning).

It uses OpenGL, GLUT, and GLUI. I think I've gotten OpenGL and GLUT to work in Codeblocks but GLUI is still giving me some issues. At first, I downloaded GLUI from here and copied glui.h into C:\Program Files (x86)\CodeBlocks\MinGW\include\GL.

I was getting an error around line 455:

void control_cb( int control ){

    if (control == 5){
    GLUI_Master.close_all();
    (...)
};

which stated there was an undefined reference to GLUI_Master.

I then realized that the GitHub repository also had a GLUI header file so I deleted the other header file and copied this new one into the same place as above.

I was able to get a little further now, getting an error around line 508:

void createSettingsMenu(){
    (...)
    new GLUI_Button( settings, "Update", 5,control_cb);
    //settings->set_main_gfx_window(mainWindow);
    (...)
};

which stated there was no matching function for call to:

GLUI_Button::GLUI_Button(GLUI*&, const char [7], int, void(&) (int)).

I'm not sure what this means, but it also says

**note: candidate: GLUI_Button::GLUI_Button()
  note: candidate expects 0 arguments, 4 provided** 

around line 847:

GLUI_Button( void ) {
    sprintf( name, "Button: %p", this );
    type         = GLUI_CONTROL_BUTTON;
    h            = GLUI_BUTTON_SIZE;
    w            = 100;
    alignment    = GLUI_ALIGN_CENTER;
    can_activate = true;
};

I'm assuming this is related to the error but I'm not sure how to fix this -- I thought this error was surely caused by an issue in setting up GLUI with Codeblocks.

genpfault
  • 51,148
  • 11
  • 85
  • 139
atlanif
  • 11
  • 1
  • `GLUI_Button( void )` as implemented takes 0 arguments however the code passes it 4. I don't think the code worked when posted to github. – drescherjm Jun 11 '19 at 04:28
  • Here is a `GLUI_Button()` that takes 4 arguments. https://www.cs.uaf.edu/2006/fall/cs381/ref/glui/classGLUI__Button.html – drescherjm Jun 11 '19 at 04:29
  • Here is a better link for `glui` https://github.com/libglui/glui/blob/master/include/GL/glui.h – drescherjm Jun 11 '19 at 04:32
  • @drescherjm Thank you so much - How would you recommend fixing this? How would I write the function differently to take the 4 arguments in GLUI_Button(GLUI*&, const char [7], int, void(&) (int)) instead of 0? – atlanif Jun 11 '19 at 20:53
  • I am saying the GLUI header that is included in the SR-Simulade-Special-Relativity-Simulator github is wrong. It does not match the expectation of having 4 parameters. You probably need to use the official source which I gave you the link. You may also have to do some work porting this. Considering that the repository had posted non-working code there may be other bugs. – drescherjm Jun 11 '19 at 20:59
  • @drescherjm Oh okay thank you - Sorry for the misunderstanding. I replaced that header file and am now getting this... #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. – atlanif Jun 12 '19 at 01:37
  • Do what the instructions say. – drescherjm Jun 12 '19 at 02:14
  • This may help: https://stackoverflow.com/questions/35723856/need-to-enable-c11-in-codeblocks – drescherjm Jun 12 '19 at 02:15

0 Answers0