PDA

View Full Version : error C2661:no overloading.... and error C2227



sGupta
07-20-2010, 03:00 PM
hi,
i am new to OpenGL. Soon i have to do a college project on this platform so i decided to learn open GL. while working with glui i am facing some problems. i downloaded glui-2.36. I thought of starting with the example1 (http://www.mediafire.com/?1ln44s9m53rppy4) that was included in source folder of glui-2.36.
i am using VB.net 2008
When i build the project it gives me 3 errors:

error C2661: 'GLUI_Checkbox::GLUI_Checkbox' : no overloaded function takes 3 arguments

error C2661: 'GLUI_Spinner::GLUI_Spinner' : no overloaded function takes 3 arguments

error C2227: left of '->set_int_limits' must point to class/struct/union/generic type

Plz help me. Thanks !

Khronos_webmaster
07-21-2010, 06:48 AM
Debugging code is an art form.

If wish to have some help from the forums, you are best to post as much detail as you can, including code samples etc. Be sure and tell us what you've done to try and solve the problem already.

sGupta
07-23-2010, 12:48 PM
i have tried all possible things i can. once thing i know for sure is the problem is not with code. This is something related to the Header files. i read on few places, where people have suggested to change the order of the header files, but didnt work for me. More over i am just a beginner, so not able to debug properly. I know the flow of prog very well, i know what is happening in the code. I wanted to practice with the sample code and once i will learn i will make my own bu for that minimum sample should work . so plz someone help me out.
The code where i am facing problem is :



/************************************************** **************************

A simple GLUT program using the GLUI User Interface Library

This program sets up a checkbox and a spinner, both with live variables.
No callbacks are used.

-----------------------------------------------------------------------

9/9/98 Paul Rademacher (rademach@cs.unc.edu)

************************************************** **************************/

#include <string.h>
#include <GL/glui.h>

/** These are the live variables passed into GLUI ***/
int wireframe = 0;
int segments = 8;
int main_window;


/***************************************** myGlutIdle() ***********/

void myGlutIdle( void )
{
/* According to the GLUT specification, the current window is
undefined during an idle callback. So we need to explicitly change
it if necessary */
if ( glutGetWindow() != main_window )
glutSetWindow(main_window);

glutPostRedisplay();
}


/**************************************** myGlutReshape() *************/

void myGlutReshape( int x, int y )
{
float xy_aspect;

xy_aspect = (float)x / (float)y;
glViewport( 0, 0, x, y );

glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -xy_aspect*.08, xy_aspect*.08, -.08, .08, .1, 15.0 );

glutPostRedisplay();
}

/***************************************** myGlutDisplay() *****************/

void myGlutDisplay( void )
{
static float rotationX = 0.0, rotationY = 0.0;

glClearColor( .9f, .9f, .9f, 1.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

/*** Rotate the object ***/
rotationX += 3.3f;
rotationY += 4.7f;

glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -1.0 );
glRotatef( rotationY, 0.0, 1.0, 0.0 );
glRotatef( rotationX, 1.0, 0.0, 0.0 );

/*** Now we render object, using the variables 'segments' and
'wireframe'. These are _live_ variables, which are transparently
updated by GLUI ***/

if ( wireframe )
glutWireTorus( .2,.5,16,segments );
else
glutSolidTorus( .2,.5,16,segments );

glutSwapBuffers();
}


/**************************************** main() ********************/

int main(int argc, char* argv[])
{
/****************************************/
/* Initialize GLUT and create window */
/****************************************/

glutInit(&amp;argc, argv);
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutInitWindowPosition( 50, 50 );
glutInitWindowSize( 300, 300 );

main_window = glutCreateWindow( "GLUI Example 1" );
glutDisplayFunc( myGlutDisplay );
glutReshapeFunc( myGlutReshape );

/****************************************/
/* Set up OpenGL lights */
/****************************************/

GLfloat light0_ambient[] = {0.1f, 0.1f, 0.3f, 1.0f};
GLfloat light0_diffuse[] = {.6f, .6f, 1.0f, 1.0f};
GLfloat light0_position[] = {1.0f, 1.0f, 1.0f, 0.0f};

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, light0_position);

/****************************************/
/* Enable z-buferring */
/****************************************/

glEnable(GL_DEPTH_TEST);


/****************************************/
/* Here's the GLUI code */
/****************************************/

GLUI *glui = GLUI_Master.create_glui( "GLUI" );
new GLUI_Checkbox( glui, "Wireframe", &amp;wireframe );
(new GLUI_Spinner( glui, "Segments:", &amp;segments ))
->set_int_limits( 3, 60 );

glui->set_main_gfx_window( main_window );

/* We register the idle callback with GLUI, *not* with GLUT */
GLUI_Master.set_glutIdleFunc( myGlutIdle );

glutMainLoop();

return EXIT_SUCCESS;
}

Rosario Leonardi
07-24-2010, 08:22 AM
I did the following:
-copy your whole program in a file (gluiTest.cpp)
-sudo apt-get install libglui-dev (install glui library)
-gcc gluiTest.cpp -lgl -lglui -ogluiTest (compile)
-./gluiTest (execute the program)
and it work fine.

In /usr/include/gl/glui.h I can find this
#define GLUI_VERSION 2.36f

so.. are you sure you are linking the right library?

sidenelen
08-23-2011, 06:12 AM
same problem here.

i create ptr from GLUI like

GLUI *glui;

then i just want to use functions of glui.

like, glui->close();

but compiler tells me that i'm forcing it to use a variable without initialized. i really do not understand :p

Alfonse Reinheart
08-23-2011, 11:08 AM
So, not only did you reply to a thread from a year ago, you did it twice.

sidenelen
08-23-2011, 02:51 PM
sorry but i had to do it. btw i realized that it was very simple problem to solve it. just ptr glui should be equal sth. maybe, next year someone need that solution.