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

时间:2012-10-11 22:19:40

标签: c implicit-declaration

我正在尝试构建一个最终因隐式声明错误而失败的无线驱动程序:

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]

这是尝试调用函数的地方:

#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 

所以,似乎只有在定义了CSCAN时才会调用它。好吧,在源文件中,如果声明了CSCAN(我相信),也会声明wl_iw_set_cscan。 Here is where it is defined (github),以及...... if you scroll up a little bit, it only seems to be dependent on CSCAN being defined

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

我甚至可以通过推出一个#define CSCAN"在wl_iw.c的顶部,它会抱怨它被定义了两次。所以我肯定CSCAN是定义的。

如果是这种情况,为什么我会收到隐式定义警告错误?自定义CSCAN以来,应定义wl_iw_set_cscan。

1 个答案:

答案 0 :(得分:2)

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