简体   繁体   English

隐式声明时出错,但函数在源文件中声明

[英]error on implicit declaration, but function is declared in source file

I am trying to build a wireless driver which is eventually failing on an implicit declaration error: 我正在尝试构建一个无线驱动程序,最终导致隐式声明错误:

wl_iw.c: In function 'wl_iw_set_priv':
wl_iw.c:7649:4: error: implicit declaration of function 'wl_iw_set_cscan' [-Werror=implicit-function-declaration]

Here is where it tries to call the function: 这是它试图调用函数的地方:

#if defined(CSCAN)

    else if (strnicmp(extra, CSCAN_COMMAND, strlen(CSCAN_COMMAND)) == 0)
        ret = wl_iw_set_cscan(dev, info, (union iwreq_data *)dwrq, extra);
#endif 

So, it seems like this will only be called if CSCAN is defined. 因此,似乎只有在定义CSCAN时才会调用此方法。 Well, in the source file, wl_iw_set_cscan is also declared if CSCAN is declared ( I believe ). 好吧,在源文件中,如果声明了CSCAN,我们也会声明wl_iw_set_cscan( 我相信 )。 Here is where it is defined (github) , and... if you scroll up a little bit, it only seems to be dependent on CSCAN being defined . 这是它定义的地方(github) ,并且...... 如果向上滚动一点,它似乎只依赖于定义的CSCAN

CSCAN is definitely defined, which is shown if I do a verbose build: CSCAN是明确定义的,如果我做了详细的构建,就会显示出来:

arm-linux-androideabi-gcc *snip* -DCSCAN *snip* -c -o /home/owner/android-wmon/core/compat-wireless-3.6-rc7-1/drivers/net/wireless/bcmdhd/wl_iw.o /home/owner/android-wmon/core/compat-wireless-3.6-rc7-1/drivers/net/wireless/bcmdhd/wl_iw.c

I can even be doubly sure by putting a "#define CSCAN" at the top of wl_iw.c and it will complain that it is defined twice. 我甚至可以通过在wl_iw.c的顶部放置一个“#define CSCAN”来加倍确定它会抱怨它被定义了两次。 So I'm positive that CSCAN is defined. 所以我很肯定CSCAN是定义的。

If this is the case, why am I getting an implicit definition warning turned error? 如果是这种情况,为什么我得到隐式定义警告转为错误? wl_iw_set_cscan should be defined since CSCAN is defined. 自定义CSCAN以来,应定义wl_iw_set_cscan。

在第5781行,还有另一个#define正在屏蔽wl_iw_set_cscan

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM