unusual error with same code on different systems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashjas
    New Member
    • Nov 2007
    • 3

    #1

    unusual error with same code on different systems

    Hello,

    though this code uses opengl library freeglut,the problem seems to be c++ related..kindly help. and all coding is done in c++

    when i try to execute the code,i get this error

    freeglut ERROR: Function <glutBitmapChar acter> called without first
    calling 'glutInit'.

    the thing of concern is that the same code runs fine on one system
    with RHEL4 and on the other with RHEL4 the error is produced...

    on ubuntu too at home i get the same error...

    On systems where the said error is produced,if i comment out all
    the lines that use the glutBitmapChara cter function....the code runs
    fine on them aswell but this isnt a solution at all...because the
    "glutinit not called first" error should come here aswell as other
    glut functions are being still used(if the compiler is fair
    enough)...and as one can see the glutInit function is being called at
    the right place in the main function..
    (for,those who dont have opengl coding experience--before one can use any draw functions of glut library,some initial modes and Init methods are to be setup...that is being done correctly,belie ve me! as all other opengl programs are running successfully.)

    the code given here is only the main() part...

    and when the said runtime error is produced,even the first cout also is not printed on the terminal...whic h means the control isnt going into main()???
    Does anyone have any clue about this??

    Help is appreciated.

    Thanks,
    Regards.

    here is the main() code:::

    Code:
    int main (int argc, char** argv)
    {
        cout<<"\n\nHIHIHIHIHIHI\n\n";
        int stat=0;
        int b;
        pid_t pID;
    
        pID = fork();
    
        if(pID==0){
            printf("pID zero %d\n",pID);
            execl("/bin/sh","/bin/sh","-c","./noutput",0);
    #ifdef __abc__
            execl("/usr/bin/bash","/usr/bin/bash","-c","./noutput",0);
    #else
            execl("/bin/bash","/bin/bash","-c","./noutput",0);
    #endif
    
        }
    
        else if(pID>0){
            printf("pID not zero %d\n",pID);
            glutInit(&argc,argv);
            glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
    
            glutInitWindowSize(1600,1200);
            glutInitWindowPosition(0,0);
    
            glutCreateWindow();
    
            init();
            createMenu();
    
            glutDisplayFunc(display);
            glutReshapeFunc(reshape);
            glutIdleFunc(display);
    
            glutKeyboardFunc(sampleKeyFunc);
            glutMouseFunc(mouseClick);
            glutMotionFunc(mouseMoveActive);
            glutPassiveMotionFunc(mouseMovePassive);
            glutMainLoop();
    
        }
        else
            printf("error in child process");
    
        return 0;
  • JonLT
    New Member
    • Jul 2007
    • 41

    #2
    Are you feeding the program the right command line arguments?

    Comment

    Working...