error c2059

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jainchar
    New Member
    • Jan 2009
    • 14

    error c2059

    hello to every one
    please tell me what is the error c2059.In my project it is related to the syntax error in Split function of the Cell class. please help me
  • lini
    New Member
    • Mar 2007
    • 12

    #2
    Google is your friend! To save you a click here is one result:

    Compiler Error C2059 (C++)

    good luck

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      Well assuming for a moment that you are using Microsoft Visual Developer Studio (or Visual C++) how on earth would we be able to tell what is wrong with your code when you have not even posted the error message let alone the code producing the error.

      Microsoft has this to say about Compiler Error C2059 (C++).

      If you want further help I suggest you post your full error message and the code producing the error.

      Comment

      • jainchar
        New Member
        • Jan 2009
        • 14

        #4
        Thanks for reply the full error message is

        error C2059:syntax error:','

        and the code is

        if (cell.Split(r*, c*))
        {
        .
        .
        .
        .
        }
        where cell is a variable of Cell class in my project of msword.h file.
        then what should i do
        Last edited by jainchar; Jan 12 '09, 05:49 PM. Reason: change

        Comment

        • manontheedge
          New Member
          • Oct 2006
          • 175

          #5
          that's still not much code to go by. But, from what you put up there it looks like you're having pointer syntax problem. Google passing pointers as arguments.

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by jainchar
            Thanks for reply the full error message is

            error C2059:syntax error:','

            and the code is

            if (cell.Split(r*, c*))
            {
            .
            .
            .
            .
            }
            where cell is a variable of Cell class in my project of msword.h file.
            then what should i do
            What are r* and c* supposed to mean? The left operand and the multiplication operator? If so, I understand the compiler diagnostic: that ',' is unexpected there, i.e. the right operand of the multiplication operator is expected then.

            kind regards,

            Jos

            Comment

            • donbock
              Recognized Expert Top Contributor
              • Mar 2008
              • 2427

              #7
              Originally posted by jainchar
              the full error message is
              error C2059:syntax error:','
              and the code is
              Code:
               if (cell.Split(r*,c*))
              What language are you using? I think we're all assuming its C++, but please tell us if you're using something else.

              Are "r" and "c" pointers that you want to dereference? If so, then perhaps you meant ...
              Code:
              if (cell.Split(*r,*c))
              Are "r" and "c" objects that you want to pass by reference? If so, then perhaps you meant ...
              Code:
              if (cell.Split(&r,&c))

              Comment

              • jainchar
                New Member
                • Jan 2009
                • 14

                #8
                Thanx for reply

                here i am using vc++ language."r" and "c" are not the pointers they ar the values of row and column in a table.But the split function having the syntax something like

                void Split(VARIANT *NumRows,VARIAN T *NumCols);

                so the NumRows and NumCols are the number of rows and cols.Is they are having the reference of rows and cols.

                Please reply me.

                Comment

                • lini
                  New Member
                  • Mar 2007
                  • 12

                  #9
                  hi jainchar,

                  as far as I understand, NumRows and NumCols in your code are pointers to VARIANT structures.

                  if NumRows is defined as

                  VARIANT NumRows;

                  then you should try:

                  if (cell.Split(&r, &c))
                  {
                  }

                  As an example of usage, maybe you can take a look here:
                  IAccessible::ac cHitTest

                  hope this helps.

                  Cheers,
                  Lini

                  Comment

                  • jainchar
                    New Member
                    • Jan 2009
                    • 14

                    #10
                    reply

                    hi lini

                    thanx for ur rply

                    but in my code they are not declared that u say.But when i am declared as u say then it will give the error.The error code is as follow

                    error C2664:'Cell:Spl it': cannot convert parameter 1 from 'int
                    *' to 'VARIANT *'

                    Then what should i do.

                    Comment

                    • lini
                      New Member
                      • Mar 2007
                      • 12

                      #11
                      That would mean, the function requires pointers to VARIANT, currently the r and c are integers. I think you would need to convert them to VARIANT.

                      Comment

                      • jainchar
                        New Member
                        • Jan 2009
                        • 14

                        #12
                        thanx for ur response
                        please tell me how i convert them.but i create a variant which stores integer value.tell me it is right or not.

                        VARIANT v;
                        VariantInit(&v) ;
                        v.vt=VT_14;
                        V_I4(&v)=r;

                        Similarly for c.and them i pass it to split function.Please reply.

                        Comment

                        • weaknessforcats
                          Recognized Expert Expert
                          • Mar 2007
                          • 9214

                          #13
                          Originally posted by jainchar
                          VARIANT v;
                          VariantInit(&v) ;
                          v.vt=VT_14;
                          V_I4(&v)=r;
                          Not correct.
                          This should be:
                          Code:
                           
                          VARIANT v;
                          VariantInit(&v);
                          v.vt=VT_I4;
                          v.lval = r;

                          Comment

                          Working...