错误:函数被视为微观 [英] error: function is taken as an micro
问题描述
大家好,
i使用一个名为minor的函数来查找
矩阵元素的次要元素,
i声明为:
float minor(float A [] [COL],int m,int n,int i,int j); //找到未成年人
在A [] []
并在文件中稍后定义为:
float minor(float A [] [COL],int m,int n,int i,int j)
{
if(m == 0 || n == 0)//单个coloumn或单行
返回1.0;
float temp [ROW] [COL]; //用于查找mod的临时矩阵(将有一行
和\
//小于父矩阵
int p,p1,q,q1; //索引
for(p = 0,p1 = 0; p <= m&& p1< =(m-1); p ++,p1 ++){
if(p == i){
p1--;
继续; //忽略行i
}
for(q = 0,q1 = 0; q< = n&& q1< =(n-1); q ++,q1 ++){
if(q == j){
q1 - ;
继续; //忽略coloumn j
}
temp [p1] [q1] = A [p] [q];
}
}
float x = mod(temp,m-1,n-1); //返回temp的决定因素
返回x;
}
当我使用gnu g ++编译它时它给出了以下错误:
solve_equation.cpp:13:51:错误:宏次要传递了5个参数,但是
只需要1
solve_equation.cpp:68:49:错误:宏次要传递了5个参数,但
仅需1个
solve_equation.cpp:76:51:错误:宏次要传递了5个参数,但是
只需要1
solve_equation.cpp:121:51:错误:宏次要通过了5个参数,
但只需要1
solve_equation.cpp:76:错误:无效的函数声明
因为看起来编译器正在服用函数minor()作为宏.....
但为什么???
以及函数声明如何无效?
i在fedora c8上使用gnu g ++ ........
谢谢
mohan gupta
hello everyone,
i use a function called minor to find the minor of an element of a
matrix ,
i declare it as :
float minor(float A[ ][COL],int m,int n,int i,int j);//find the minor
in A[][]
and define it later in the file as :
float minor(float A[][COL],int m,int n,int i,int j)
{
if(m==0 ||n==0)//single coloumn or single row
return 1.0;
float temp[ROW][COL];//temp matrix used to find mod (will have one row
and \
//less than the parent matrix
int p,p1,q,q1;//indexes
for(p=0,p1=0;p<=m&& p1<=(m-1);p++,p1++){
if(p==i){
p1--;
continue;//ignore row i
}
for(q=0,q1=0;q<=n && q1<=(n-1);q++,q1++){
if(q==j){
q1--;
continue;//ignore coloumn j
}
temp[p1][q1]=A[p][q];
}
}
float x= mod(temp,m-1,n-1);//return the determinant of temp
return x;
}
when i compile it using gnu g++ it gives the following error :
solve_equation.cpp:13:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:68:49: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:76:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:121:51: error: macro "minor" passed 5 arguments,
but takes just 1
solve_equation.cpp:76: error: invalid function declaration
as it seems the compiler is taking function minor() as macro .....
but why???
and how is the function declaration invalid??
i use gnu g++ on fedora c8........
thank you
mohan gupta
推荐答案
8月21日,12:19 * pm,mohi< mohangupt ... @ gmail.comwrote:
On Aug 21, 12:19*pm, mohi <mohangupt...@gmail.comwrote:
因为看起来编译器正在将函数minor()作为宏.....
但为什么???
以及函数声明如何无效?
as it seems the compiler is taking function minor() as macro .....
but why???
and how is the function declaration invalid??
这不是一个标准的宏;它是您的代码特有的东西,
您的系统或第三方库。你可以在你的
标题中#undef:
#ifdef minor
#undef minor
#endif
干杯! --M
That''s not a standard macro; it''s something specific to your code,
your system, or third-party libraries. You can #undef it in your
header:
#ifdef minor
# undef minor
#endif
Cheers! --M
2008年8月21日星期四09:19:40 -0700,mohi写道:
On Thu, 21 Aug 2008 09:19:40 -0700, mohi wrote:
大家好,
i使用一个名为minor的函数来查找
矩阵元素的次要元素,
i声明它as:
float minor(float A [] [COL],int m,int n,int i,int j); //在
$ b中找到未成年人$ b A [] []
hello everyone,
i use a function called minor to find the minor of an element of a
matrix ,
i declare it as :
float minor(float A[ ][COL],int m,int n,int i,int j);//find the minor in
A[][]
[...]
[...]
当我使用gnu编译它时g ++它给出以下错误:
solve_equation.cpp:13:51:错误:宏次要传递了5个参数,但是
只需要1
solve_equation.cpp:68:49:错误:宏次要传递了5个参数,但
仅需1个
solve_equation.cpp:76:51:错误:宏次要传递了5个参数,但是
只需要1
solve_equation.cpp:121:51:错误:宏次要传递了5个参数,但是
只需要1
solve_equation.cpp:76:错误:函数声明无效
似乎编译器将函数minor()作为宏.....但是
为什么???
when i compile it using gnu g++ it gives the following error :
solve_equation.cpp:13:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:68:49: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:76:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:121:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:76: error: invalid function declaration
as it seems the compiler is taking function minor() as macro ..... but
why???
也许真的*是*在某处定义了一个名为minor的宏?尝试
给你的函数一个不同的名字,看它是否编译。或插入
一些代码如:
#ifdef minor
#error macro minor已定义!
$ b在你的函数声明之前$ b #endif
。
Maybe there really *is* a macro called `minor'' defined somewhere? Try
giving your function a different name and see if it compiles. Or insert
some code like:
#ifdef minor
#error macro minor already defined!
#endif
before your function declaration.
以及函数声明如何无效?
and how is the function declaration invalid??
如果在
声明中定义了一个宏次要,它将无效,因为预处理器将替换
中的'minor''宏在编译器看到之前你的函数声明。
-
Lionel B >
8月21日,9:37 pm,Lionel B< m ... @ privacy.netwrote:
On Aug 21, 9:37 pm, Lionel B <m...@privacy.netwrote:
2008年8月21日星期四09:19:40 -0700,mohi写道:
On Thu, 21 Aug 2008 09:19:40 -0700, mohi wrote:
大家好,
hello everyone,
i使用一个名为minor的函数来查找
矩阵元素的次要元素,
i将其声明为:
i use a function called minor to find the minor of an element of a
matrix ,
i declare it as :
float minor(float A [] [COL],int m,int n,int i,int j); //在
中找到未成年人A [] []
float minor(float A[ ][COL],int m,int n,int i,int j);//find the minor in
A[][]
[...]
[...]
当我编译它时g gnu g ++它给出了以下错误:
when i compile it using gnu g++ it gives the following error :
solve_equation.cpp:13:51:error:macro" minor"传递了5个参数,但是
只需要1
solve_equation.cpp:68:49:错误:宏次要传递了5个参数,但
仅需1个
solve_equation.cpp:76:51:错误:宏次要传递了5个参数,但是
只需要1
solve_equation.cpp:121:51:错误:宏次要传递了5个参数,但
仅需1
solve_equation.cpp:76:错误:无效函数声明
solve_equation.cpp:13:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:68:49: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:76:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:121:51: error: macro "minor" passed 5 arguments, but
takes just 1
solve_equation.cpp:76: error: invalid function declaration
因为看起来编译器正在将函数minor()作为宏.....但是
为什么???
as it seems the compiler is taking function minor() as macro ..... but
why???
也许真的*是*在某处定义了一个名为minor的宏?尝试
给你的函数一个不同的名字,看它是否编译。或插入
一些代码如:
#ifdef minor
#error macro minor已定义!
$ b在你的函数声明之前$ b #endif
。
Maybe there really *is* a macro called `minor'' defined somewhere? Try
giving your function a different name and see if it compiles. Or insert
some code like:
#ifdef minor
#error macro minor already defined!
#endif
before your function declaration.
以及函数声明如何无效?
and how is the function declaration invalid??
如果在
声明中定义了一个宏次要,它将无效,因为预处理器将替换
中的'minor''宏在编译器看到之前你的函数声明。
-
Lionel B
It will be invalid if there is a macro `minor'' defined at the point of
declaration, since the preprocessor will substitute the `minor'' macro in
your function declaration before the compiler sees it.
--
Lionel B
谢谢你们......
这是未成年人被宣布为宏的真正问题
某处:::
但我从来没有把它定义为微型和下级我使用任何第三个
派对库,
起始包括和我的代码的函数声明如下:
#include< iostream>
#include< cmath>
#include< cstdlib> ;
使用命名空间std;
#define ROW 20
#define COL 20
#ifdef minor
#undef minor
#endif
void get_array(float [ROW] [COL], int *,int *); //获取数组中的输入
void inverse(float [] [COL],int,int); //反转arary
void multiply(float [] [COL],int,int,float [ ] [COL],int,int,float
result [] [COL]); //乘以两个数组
float minor(float A [] [COL], int m,int n,int i,int j); //在A []中找到次要的
[]
float mod(float A [] [COL] ,int m,int n);
void transpose(float temp [] [COL],int m,int n,float A [] [COL]); // find
中的临界温度$
void显示(浮动A [] [COL],int m,int n); //显示数组A [] []
void divide(float array [] [COL],int m,int n,float value); //划分
矩阵数组
// value
(其中我现在未定义次要),,,,但我知道所有标准
libarray变量用下划线声明
说" __micro(我知道它不是一个坚硬而快速的规则)所以
哪里可以宣布????它可以在cmath ????
谢谢
mohan
thank you guys ...
that was the real problem that minor was declared as macro
somewhere:::
but i never defined it as an micro and nether am i using any third
party library ,
the starting includes and function declarations of my code are as:
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;
#define ROW 20
#define COL 20
#ifdef minor
#undef minor
#endif
void get_array(float [ROW][COL],int* ,int* );//get the input in array
void inverse(float [][COL],int ,int);//inverse the arary
void multiply(float [][COL],int,int,float [][COL],int,int,float
result[][COL] );//multiply two array
float minor(float A[][COL],int m,int n,int i,int j);//find the minor
in A[][]
float mod(float A[][COL],int m,int n);
void transpose(float temp[][COL],int m,int n,float A[][COL]);//find
trnpos of temp in A
void display(float A[][COL],int m,int n);//display array A[][]
void divide(float array[][COL],int m,int n,float value);//divide
matrix array by
//value
(where i now undefined minor) ,,,,but as i know all the standard
libarray variable are declared with an underscore
say" __micro "(i know that its not an hard and fast rule though) so
where could it have been declared ????can it be in cmath????
thank you
mohan
这篇关于错误:函数被视为微观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!