Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. hello well i get a very weird error and cant fix it i know it has do to something with brackets )

hello well i get a very weird error and cant fix it i know it has do to something with brackets )

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nah1337
    wrote on last edited by
    #1

    #define R_GLDRAWELEMENTS 0x5ED02FD4

    WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);

    WINAPI (*R_glDrawElements)(GLenum , GLsizei , GLenum , const GLvoid *) = (void (__stdcall*) (unsigned int,int,unsigned int,void const *)) R_GLDRAWELEMENTS;

    WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
    {

    _R_glDrawElements( mode, count, type, indices);

    }

    The 3 line of code gives a bad error error C2059: syntax error : '(' And i dont know what is wrong with it the brackets seems to be all in place....

    S _ 2 Replies Last reply
    0
    • N nah1337

      #define R_GLDRAWELEMENTS 0x5ED02FD4

      WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);

      WINAPI (*R_glDrawElements)(GLenum , GLsizei , GLenum , const GLvoid *) = (void (__stdcall*) (unsigned int,int,unsigned int,void const *)) R_GLDRAWELEMENTS;

      WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
      {

      _R_glDrawElements( mode, count, type, indices);

      }

      The 3 line of code gives a bad error error C2059: syntax error : '(' And i dont know what is wrong with it the brackets seems to be all in place....

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      I'm not 100% sure how you didn't get other compiler errors, to be honest. I get errors where you've used WINAPI, as that doesn't (on my Windows installation) specify a return type - I have #define WINAPI __stdcall - just a calling convention. Also - in the body of _R_glDrawElements, you call _R_glDrawElements recursively - that'll cause a stack overflow. Did you really mean R_glDrawElements?? Anyway - try this (modulo changing the body of _R_glDrawElements if I was correct above)

      #define R_GLDRAWELEMENTS 0x5ED02FD4

      void WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);

      void (WINAPI* R_glDrawElements)(GLenum , GLsizei , GLenum , const GLvoid *) = (void (__stdcall*) (unsigned int,int,unsigned int,void const *)) R_GLDRAWELEMENTS;

      void WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
      {

      _R_glDrawElements( mode, count, type, indices);

      }

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      1 Reply Last reply
      0
      • N nah1337

        #define R_GLDRAWELEMENTS 0x5ED02FD4

        WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);

        WINAPI (*R_glDrawElements)(GLenum , GLsizei , GLenum , const GLvoid *) = (void (__stdcall*) (unsigned int,int,unsigned int,void const *)) R_GLDRAWELEMENTS;

        WINAPI _R_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
        {

        _R_glDrawElements( mode, count, type, indices);

        }

        The 3 line of code gives a bad error error C2059: syntax error : '(' And i dont know what is wrong with it the brackets seems to be all in place....

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        In addition to Stuart's reply, it is recommended to type define function pointers. It makes the code all the more readable.

        typedef void (WINAPI* PFN_GLDRAWELEMENTS)(GLenum , GLsizei , GLenum , const GLvoid *);
        PFN_GLDRAWELEMENTS R_glDrawElements = (PFN_GLDRAWELEMENTS)R_GLDRAWELEMENTS;

        «_Superman_» I love work. It gives me something to do between weekends.

        N 1 Reply Last reply
        0
        • _ _Superman_

          In addition to Stuart's reply, it is recommended to type define function pointers. It makes the code all the more readable.

          typedef void (WINAPI* PFN_GLDRAWELEMENTS)(GLenum , GLsizei , GLenum , const GLvoid *);
          PFN_GLDRAWELEMENTS R_glDrawElements = (PFN_GLDRAWELEMENTS)R_GLDRAWELEMENTS;

          «_Superman_» I love work. It gives me something to do between weekends.

          N Offline
          N Offline
          nah1337
          wrote on last edited by
          #4

          I tryed your methods but it dosent work .... typedef VOID (WINAPI* R_glDrawElements_) (GLenum , GLsizei , GLenum , const GLvoid *); R_glDrawElements_ pR_glDrawElements = 0x5ED02FD4; And doing this i get error C:\Documents and Settings\ivor\Desktop\test5\Client.cpp(23) : error C2440: 'initializing' : cannot convert from 'const int' to 'void (__stdcall *)(unsigned int,int,unsigned int,const void *)'

          _ N 2 Replies Last reply
          0
          • N nah1337

            I tryed your methods but it dosent work .... typedef VOID (WINAPI* R_glDrawElements_) (GLenum , GLsizei , GLenum , const GLvoid *); R_glDrawElements_ pR_glDrawElements = 0x5ED02FD4; And doing this i get error C:\Documents and Settings\ivor\Desktop\test5\Client.cpp(23) : error C2440: 'initializing' : cannot convert from 'const int' to 'void (__stdcall *)(unsigned int,int,unsigned int,const void *)'

            _ Offline
            _ Offline
            _Superman_
            wrote on last edited by
            #5

            nah1337 wrote:

            R_glDrawElements_ pR_glDrawElements = 0x5ED02FD4;

            You need the typecast here. R_glDrawElements_ pR_glDrawElements = **(R_glDrawElements_)**0x5ED02FD4;

            «_Superman_» I love work. It gives me something to do between weekends.

            1 Reply Last reply
            0
            • N nah1337

              I tryed your methods but it dosent work .... typedef VOID (WINAPI* R_glDrawElements_) (GLenum , GLsizei , GLenum , const GLvoid *); R_glDrawElements_ pR_glDrawElements = 0x5ED02FD4; And doing this i get error C:\Documents and Settings\ivor\Desktop\test5\Client.cpp(23) : error C2440: 'initializing' : cannot convert from 'const int' to 'void (__stdcall *)(unsigned int,int,unsigned int,const void *)'

              N Offline
              N Offline
              nah1337
              wrote on last edited by
              #6

              Hello again thnx for previous replay well i still struggling with it and now i dosent just understand why i get the error i dont change anything after typedef .... typedef VOID (WINAPI* R_glDrawElements_) (GLenum , GLsizei , GLenum , const GLvoid *); R_glDrawElements_ pR_glDrawElements = (R_glDrawElements_)0x5ED02FD4; VOID WINAPI R_glDrawElements_(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { R_glDrawElements_( mode, count, type, indices); } C:\Documents and Settings\ivor\Desktop\test5\Client.cpp(56) : error C2377: 'R_glDrawElements_' : redefinition; typedef cannot be overloaded with any other symbol C:\Documents and Settings\ivor\Desktop\test5\Client.cpp(27) : see declaration of 'R_glDrawElements_'

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups