macro passed wrong number of arguments

Discussion in 'C++' started by Martin Magnusson, Jun 15, 2004.

  1. I'm using a matrix and vector library, that won't compile. When
    running g++ I get the error message "macro "minor" passed 5 arguments,
    but takes just 1"

    The definition of "minor" looks like below, and it takes 3 arguments.
    All calls to minor that I have found in the code also pass it three
    arguments, so I really don't understand this error.

    Does anything look suspicious with the following definition, or must
    it be that there is some other definition of minor with a different
    number of arguments somewhere?

    template <int N, typename T>
    T minor(const Vector<N,Vector<N,T> >& in, int row, int col) //ERROR
    {
    Vector<N-1,Vector<N-1,T> > tmp;
    int dst_row, dst_col;
    dst_row = 0;
    for (int src_row = 0; src_row < N; src_row++) {
    if (src_row == row) continue;
    dst_col = 0;
    for (int src_col = 0; src_col < N; src_col++) {
    if (src_col == col) continue;
    tmp[dst_row][dst_col] = in[src_row][src_col];
    dst_col++;
    }
    dst_row++;
    }
    return det(tmp);
    }



    Thanks
    / martin
    Martin Magnusson, Jun 15, 2004
    #1
    1. Advertising

  2. Martin Magnusson

    Rolf Magnus Guest

    Martin Magnusson wrote:

    > I'm using a matrix and vector library, that won't compile. When
    > running g++ I get the error message "macro "minor" passed 5 arguments,
    > but takes just 1"
    >
    > The definition of "minor" looks like below, and it takes 3 arguments.
    > All calls to minor that I have found in the code also pass it three
    > arguments, so I really don't understand this error.


    The definition below is a template, not a macro. So it seems to me that
    somewhere in your code or any header you #include, a macro is defined
    that also has the name "minor".

    > Does anything look suspicious with the following definition, or must
    > it be that there is some other definition of minor with a different
    > number of arguments somewhere?


    The latter.
    Rolf Magnus, Jun 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dee
    Replies:
    9
    Views:
    493
    Joseph Byrns
    Apr 15, 2005
  2. Martin Magnusson

    macro passed wrong number of arguments

    Martin Magnusson, Jun 15, 2004, in forum: C++
    Replies:
    4
    Views:
    529
    red floyd
    Jun 15, 2004
  3. Anand
    Replies:
    2
    Views:
    887
    Anand
    Sep 11, 2003
  4. rashmi
    Replies:
    6
    Views:
    366
    rashmi
    Dec 7, 2006
  5. srdgame
    Replies:
    5
    Views:
    476
    srdgame
    Mar 6, 2009
Loading...

Share This Page