mixed implicit and normal rules. Stop.

当你make menuconfig的时候,很不幸地,出现了以下问题:

(1)$ make menuconfig
Makefile:386: *** mixed implicit and normal rules.  Stop.

按照以下步骤修改:

  • vim Makefile

    修改报错的line 386,linux linux%_only:                      to                 linux:
    然后make menuconfig就貌似可以了.

    (2)make dep,继续报错:

    make[1]: Entering directory `/home/xxx/xxx/linux-2.6.28.10'
    Makefile:1614: *** mixed implicit and normal rules.  Stop.
    make[1]: Leaving directory `/home/xxx/xxx/linux-2.6.28.10'

  • vim linux-2.6.28.10/Makefile

    修改报错的line 1614,/ %/: prepare scripts FORCE            to             %/: prepare scripts FORCE

    (3)make dep,继续报错:

    make[1]: Entering directory `/home/xxx/xxx/linux-2.6.28.10'
    /home/xxx/xxx/linux-2.6.28.10/Makefile:446: *** mixed implicit and normal rules.  Stop.

  • vim linux-2.6.28.10/Makefile

    修改报错的line 446,config %config: scripts_basic outputmakefile FORCE       to             %config: scripts_basic outputmakefile FORCE

    (3)make,继续报错:

    make[3]: Entering directory /home/xxx/xxx/user/busybox'
    Makefile:1269: *** mixed implicit and normal rules.  Stop.
    make[3]: Leaving directory /home/xxx/xxx/user/busybox'

    修改报错的line 1269,/ %/: prepare scripts FORCE                                             to              %/: prepare scripts FORCE

    顺便修改config %config: scripts_basic outputmakefile FORCE       to              %config: scripts_basic outputmakefile FORCE
    (4)make
    make[1]: Entering directory /home/xxx/xxx/vendors'
    Makefile:28: *** mixed implicit and normal rules.  Stop.
    make[1]: Leaving directory /home/xxx/xxx/vendors'

    差不多的改法。而且不一定大家也会在这里出错。

    如果你只是想解决这个问题的话,直接按以下步骤修改,just go on!

    1、vim toolchain/buildroot/package/atk/atk.mk

      ATK_CONF_OPT =  --enable-shared \
                                       --enable-static                   to                  --enable-static \

    2、vim linux-2.6.28.10/Makefile

    config %config: scripts_basic outputmakefile FORCE       to             %config: scripts_basic outputmakefile FORCE
    / %/: prepare scripts FORCE                                             to             %/: prepare scripts FORCE

    3、vim user/busybox/Makefile

    config %config: scripts_basic outputmakefile FORCE       to              %config: scripts_basic outputmakefile FORCE
    / %/: prepare scripts FORCE                                             to              %/: prepare scripts FORCE

    4、vim Makefile

    linux linux%_only:                      to                 linux:

    5、vim vendors/Makefile

    all image clean romfs romfs.post vendor_%:

    to

    all image clean romfs romfs.post:
     $(MAKE) -C $(dir_v) dir_v=$(dir_v) -f $(VEND)/vendors-common.mak $@

    vendor_%:


    6、make menuconfig

    OK

     

### 函数隐式声明编译错误的原因 在C/C++程序中遇到`implicit declaration of function`编译警告或错误意味着编译器遇到了未事先声明的函数调用。对于标准库中的函数,如`getopt()`,通常是因为缺少必要的头文件包含语句[^1]。 ### 解决方案一:包含正确的头文件 如果问题是由于缺失了特定的标准库函数定义,则应确保包含了相应的头文件。例如,在使用`getopt()`的情况下: ```c #include <unistd.h> /* 包含 getopt 的定义 */ ``` 这可以防止编译器因找不到该函数原型而发出警告或报错。 ### 解决方案二:处理C和C++混编情况下的名称修饰差异 当涉及到C与C++之间的互操作时,可能会因为两种语言不同的命名约定而导致链接阶段出现问题。为了使C++代码能够正确解析来自C源码的外部符号,可以在适当位置加入如下语法结构来告知编译器保持原始的名字编码方式而不加以修改: ```cpp #ifdef __cplusplus extern "C" { #endif /* C风格的函数声明 */ #ifdef __cplusplus } #endif ``` 此方法适用于任何需要跨语言共享接口的情形,并能有效消除由不同语言特性引起的潜在冲突[^2]。 ### 解决方案三:显式声明未知函数 对于自定义而非标准库内的函数,应当提前对其进行正确定义或至少提供完整的前向声明(即函数签名)。这样不仅有助于提高代码可读性和维护性,也能避免不必要的编译期告警。比如: ```c int myFunction(int arg); // 前置声明 ... myFunction(42); // 正确调用已知函数 ``` 通过上述措施之一或多者组合应用,应该可以彻底解决`implicit declaration of function`这类编译问题[^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值