none
error C2660 RRS feed

  • Question

  • 0

    hi every one.......

     
     #include <stdlib.h> 
    #include <stdio.h>
    #include <glut.h>
    #define HISTOGRAM_SIZE  256   /* Must be a power of 2 */
    #define GL_RGB 0x1907
    #define GL_FALSE 0

    extern GLubyte*  readImage(const char*, GLsizei*, GLsizei*);

    GLubyte  *pixels;
    GLsizei   width, height;
    int GL_HISTOGRAM;
    int glHistogram();
    int glGetHistogram();

    void init(void)
    {
        int GL_HISTOGRAM;
       glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
       glClearColor(0.0, 0.0, 0.0, 0.0);
       glHistogram();
       glEnable(GL_HISTOGRAM);
    }




    void display(void)
    {
       int i;
       GLushort values[HISTOGRAM_SIZE][3];
      
       glClear(GL_COLOR_BUFFER_BIT);
       glRasterPos2i(1, 1);
       glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
      
       glGetHistogram(GL_HISTOGRAM, GL_TRUE, GL_RGB, GL_UNSIGNED_SHORT, values);

       /* Plot histogram */
      
       glBegin(GL_LINE_STRIP);
       glColor3f(1.0, 0.0, 0.0);
       for ( i = 0; i < HISTOGRAM_SIZE; i++ )
           glVertex2s(i, values[i][0]);
       glEnd();

       glBegin(GL_LINE_STRIP);
       glColor3f(0.0, 1.0, 0.0);
       for ( i = 0; i < HISTOGRAM_SIZE; i++ )
           glVertex2s(i, values[i][1]);
       glEnd();

       glBegin(GL_LINE_STRIP);
       glColor3f(0.0, 0.0, 1.0);
       for ( i = 0; i < HISTOGRAM_SIZE; i++ )
           glVertex2s(i, values[i][2]);
       glEnd();
       glFlush();
    }

    void reshape(int w, int h)
    {
       glViewport(0, 0, (GLsizei) w, (GLsizei) h);
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       glOrtho(0, 256, 0, 10000, -1.0, 1.0);
       glMatrixMode(GL_MODELVIEW);
    }

    void keyboard(unsigned char key, int x, int y)
    {
       static GLboolean sink = GL_FALSE;
       
       switch (key) {
          case 's' :
          sink = !sink;
          glHistogram(GL_HISTOGRAM, HISTOGRAM_SIZE, GL_RGB, sink);
          break;
         
          case 27:
             exit(0);
       }
       glutPostRedisplay();
      
    }

     
    int main(int argc, char** argv)
    {
       pixels = readImage("Data/rat.jpg", &width, &height);   


       glutInit(&argc, argv);
       glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
       glutInitWindowSize(width, height);
       glutInitWindowPosition(100, 100);
       glutCreateWindow(argv[0]);
       init();
       glutReshapeFunc(reshape);
       glutKeyboardFunc(keyboard);
       glutDisplayFunc(display);
       glutMainLoop();
       return 0;
    }








    1>------ Build started: Project: h2, Configuration: Debug Win32 ------
    1>Compiling...
    1>h2.cpp
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(40) : error C2660: 'glGetHistogram' : function does not take 5 arguments
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(80) : error C2660: 'glHistogram' : function does not take 4 arguments
    1>Build log was saved at "file://c:\Documents and Settings\kesar\My Documents\Visual Studio 2008\Projects\h2\h2\Debug\BuildLog.htm"
    1>h2 - 2 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========








    i cant run above program plz help out.....

    thanks........

    • Moved by Calvin_Gao Friday, January 21, 2011 7:32 AM Move to appropriate forum (From:Visual Basic General)
    Wednesday, January 19, 2011 5:21 AM

Answers

  • You are using sink without declaring it int init()
     glHistogram(GL_HISTOGRAM, HISTOGRAM_SIZE, GL_RGB, sink);

    These are simple mistakes that bring the code down. Please check the whole code carefully. And move this question to C# forums.

    Please Mark as Answered If this answers your question Or UnMark as Answered if it did not.
    Happy to Help :)
    My Blog
    Friday, January 21, 2011 5:15 AM

All replies

  • You have declared two functions in before main as

    int glHistogram();

    int glGetHistogram();

    which do not take any arguments!

     

    Then in your code you are passing arguments to them:

     glGetHistogram(GL_HISTOGRAM, GL_TRUE, GL_RGB, GL_UNSIGNED_SHORT, values); //5 args

    glHistogram(GL_HISTOGRAM, HISTOGRAM_SIZE, GL_RGB, sink); //4 args.

     

    Thats why you get the error:

     

    'glGetHistogram' : function does not take 5 arguments

    'glHistogram' : function does not take 4 arguments

     


    Please Mark as Answered If this answers your question Or UnMark as Answered if it did not.
    Happy to Help :)
    My Blog
    • Proposed as answer by vijaykamat Tuesday, January 25, 2011 6:53 AM
    Wednesday, January 19, 2011 5:27 AM
  • thanks

    i declared properly dint run dat program

    i got some more errors

    i.e.

    1>------ Build started: Project: h2, Configuration: Debug Win32 ------
    1>Compiling...
    1>h2.cpp
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(16) : error C2065: 'sink' : undeclared identifier
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(16) : error C2078: too many initializers
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(17) : error C2065: 'values' : undeclared identifier
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(17) : error C2078: too many initializers
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(24) : error C2065: 'sink' : undeclared identifier
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(40) : error C2064: term does not evaluate to a function taking 5 arguments
    1>c:\documents and settings\kesar\my documents\visual studio 2008\projects\h2\h2\h2.cpp(80) : error C2064: term does not evaluate to a function taking 4 arguments
    1>Build log was saved at "file://c:\Documents and Settings\kesar\My Documents\Visual Studio 2008\Projects\h2\h2\Debug\BuildLog.htm"
    1>h2 - 7 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Thursday, January 20, 2011 8:01 AM
  • Wrong forum, this is Visual Basic not C++

     

    Try this one

    http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/threads


    Success
    Cor
    Thursday, January 20, 2011 8:10 AM
  • vijaykamat,

    Make you the same kind of mistakes also in your programs, you better can switch to Visual Basic, that has a better automatic error correction. 

    Every day C# code in the Visual Basic forum, or is this not a mistake?

     


    Success
    Cor
    Thursday, January 20, 2011 8:12 AM
  • I thought the code in question was in C# so answered in C# with an understanding that the thread will be moved.. Will keep this in mind hence forth :)

    @shivu k, Please post the code. Wanna see the modifications (on C# forums if possible).


    Please Mark as Answered If this answers your question Or UnMark as Answered if it did not.
    Happy to Help :)
    My Blog
    Thursday, January 20, 2011 8:31 AM
  • @Shiva

    I don't think it is moved to the C# forum.

     


    Success
    Cor
    Thursday, January 20, 2011 11:59 AM
  • the code here...........

    reply soon.....plz

     
     #include <stdlib.h> 
    #include <stdio.h>
    #include <glut.h>
    #define HISTOGRAM_SIZE  256   /* Must be a power of 2 */
    #define GL_RGB 0x1907
    #define GL_FALSE 0

    extern GLubyte*  readImage(const char*, GLsizei*, GLsizei*);

    GLubyte  *pixels;
    GLsizei   width, height;
    int GL_HISTOGRAM;
    int  glHistogram(GL_HISTOGRAM, HISTOGRAM_SIZE, GL_RGB, sink);
    int glGetHistogram(GL_HISTOGRAM, GL_TRUE, GL_RGB, GL_UNSIGNED_SHORT, values);

    void init(void)
    {
        int GL_HISTOGRAM;
       glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
       glClearColor(0.0, 0.0, 0.0, 0.0);
       glHistogram(GL_HISTOGRAM, HISTOGRAM_SIZE, GL_RGB, sink);
       glEnable(GL_HISTOGRAM);
    }




    void display(void)
    {
       int i;
       GLushort values[HISTOGRAM_SIZE][3];
      
       glClear(GL_COLOR_BUFFER_BIT);
       glRasterPos2i(1, 1);
       glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
      
       glGetHistogram(GL_HISTOGRAM, GL_TRUE, GL_RGB, GL_UNSIGNED_SHORT, values);

       /* Plot histogram */
      
       glBegin(GL_LINE_STRIP);
       glColor3f(1.0, 0.0, 0.0);
       for ( i = 0; i < HISTOGRAM_SIZE; i++ )
           glVertex2s(i, values[i][0]);
       glEnd();

       glBegin(GL_LINE_STRIP);
       glColor3f(0.0, 1.0, 0.0);
       for ( i = 0; i < HISTOGRAM_SIZE; i++ )
           glVertex2s(i, values[i][1]);
       glEnd();

       glBegin(GL_LINE_STRIP);
       glColor3f(0.0, 0.0, 1.0);
       for ( i = 0; i < HISTOGRAM_SIZE; i++ )
           glVertex2s(i, values[i][2]);
       glEnd();
       glFlush();
    }

    void reshape(int w, int h)
    {
       glViewport(0, 0, (GLsizei) w, (GLsizei) h);
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       glOrtho(0, 256, 0, 10000, -1.0, 1.0);
       glMatrixMode(GL_MODELVIEW);
    }

    void keyboard(unsigned char key, int x, int y)
    {
       static GLboolean sink = GL_FALSE;
       
       switch (key) {
          case 's' :
          sink = !sink;
          glHistogram(GL_HISTOGRAM, HISTOGRAM_SIZE, GL_RGB, sink);
          break;
         
          case 27:
             exit(0);
       }
       glutPostRedisplay();
      
    }

     
    int main(int argc, char** argv)
    {
       pixels = readImage("Data/rat.jpg", &width, &height);   


       glutInit(&argc, argv);
       glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
       glutInitWindowSize(width, height);
       glutInitWindowPosition(100, 100);
       glutCreateWindow(argv[0]);
       init();
       glutReshapeFunc(reshape);
       glutKeyboardFunc(keyboard);
       glutDisplayFunc(display);
       glutMainLoop();
       return 0;
    }









    Friday, January 21, 2011 5:02 AM
  • actually it in c++
    Friday, January 21, 2011 5:08 AM
  • You are using sink without declaring it int init()
     glHistogram(GL_HISTOGRAM, HISTOGRAM_SIZE, GL_RGB, sink);

    These are simple mistakes that bring the code down. Please check the whole code carefully. And move this question to C# forums.

    Please Mark as Answered If this answers your question Or UnMark as Answered if it did not.
    Happy to Help :)
    My Blog
    Friday, January 21, 2011 5:15 AM
  • Hi shivu,

    I'm moving this thread to Visual C++ General forum for better response.

     

    Thank you for your understanding and support.

    Best Regards,


    Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 21, 2011 7:29 AM