OpenHarmony开发者论坛

标题: fatal error: iot_gpio.h: No such file or directory [打印本页]

作者: hubin    时间: 2023-11-30 13:23
标题: fatal error: iot_gpio.h: No such file or directory
[md]案例编译失败了,这是错误日志,不知道这个头文件在哪里,为什么会出现这个错误。

```
[OHOS ERROR] [1/68] gcc cross compiler obj/applications/sample/wifi-iot/app/pwm_demo/libpwm_demo.pwm_led.o
[OHOS ERROR] FAILED: obj/applications/sample/wifi-iot/app/pwm_demo/libpwm_demo.pwm_led.o
[OHOS ERROR] riscv32-unknown-elf-gcc -D_XOPEN_SOURCE=700 -DOHOS_DEBUG -D__LITEOS__ -D__LITEOS_M__ -I../../../utils/native/lite/include -I../../../kernel/liteos_m/kal -I../../../base/iot_hardware/peripheral/interfaces/kits -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/system/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/config -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/config/nv -I../../../commonlibrary/utils_lite/include -I../../../device/soc/hisilicon/hi3861v100/hi3861_adapter/kal/cmsis -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/kernel/base/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/kernel/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/arch/risc-v/rv32im -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libm/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libsec/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/net/wpa_supplicant-2.7/src/common -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/plat/riscv -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/kernel/extended/runstop -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/posix/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/linux/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/third_party/lwip_sack/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/musl/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/generic -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/riscv32 -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/hw/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/nuttx/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/config -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/user -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/plat -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/extend/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/arch -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/bionic/libm -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/shell/include -I../../../device/soc/hisilicon/hi3861v100/sdk_liteos/platform/os/Huawei_LiteOS/net/telnet/include -Os -mabi=ilp32 -falign-functions=2 -msave-restore -fno-optimize-strlen -freorder-blocks-algorithm=simple -fno-schedule-insns -fno-inline-small-functions -fno-inline-functions-called-once -mtune=size -mno-small-data-limit=0 -fno-aggressive-loop-optimizations -std=c99 -Wpointer-arith -Wstrict-prototypes -ffunction-sections -fdata-sections -fno-exceptions -fno-short-enums -Wextra -Wundef -U PRODUCT_CFG_BUILD_TIME -DLOS_COMPILE_LDM -DPRODUCT_USR_SOFT_VER_STR=None -DCYGPKG_POSIX_SIGNALS -D__ECOS__ -D__RTOS_ -DPRODUCT_CFG_HAVE_FEATURE_SYS_ERR_INFO -D__LITEOS__ -DLIB_CONFIGURABLE -DLOSCFG_SHELL -DLOSCFG_CACHE_STATICS -DCUSTOM_AT_COMMAND -DLOS_COMPILE_LDM -DLOS_CONFIG_IPERF3 -DCMSIS_OS_VER=2 -DSECUREC_ENABLE_SCANF_FILE=0 -DCONFIG_AT_COMMAND -DPRODUCT_CFG_CHIP_VER_STR=Hi3861V100 -DCHIP_VER_Hi3861 -DPRODUCT_CFG_SOFT_VER_STR=Hi3861 -DHI_BOARD_ASIC -DHI_ON_FLASH -DLITEOS_WIFI_IOT_VERSION -mabi=ilp32 -falign-functions=2 -msave-restore -fno-optimize-strlen -freorder-blocks-algorithm=simple -fno-schedule-insns -fno-inline-small-functions -fno-inline-functions-called-once -mtune=size -mno-small-data-limit=0 -fno-aggressive-loop-optimizations -std=c99 -Wpointer-arith -Wstrict-prototypes -ffunction-sections -fdata-sections -fno-exceptions -fno-short-enums -Wextra -Wundef -U PRODUCT_CFG_BUILD_TIME -DLOS_COMPILE_LDM -DPRODUCT_USR_SOFT_VER_STR=None -DCYGPKG_POSIX_SIGNALS -D__ECOS__ -D__RTOS_ -DPRODUCT_CFG_HAVE_FEATURE_SYS_ERR_INFO -D__LITEOS__ -DLIB_CONFIGURABLE -DLOSCFG_SHELL -DLOSCFG_CACHE_STATICS -DCUSTOM_AT_COMMAND -DLOS_COMPILE_LDM -DLOS_CONFIG_IPERF3 -DCMSIS_OS_VER=2 -DSECUREC_ENABLE_SCANF_FILE=0 -DCONFIG_AT_COMMAND -DPRODUCT_CFG_CHIP_VER_STR=Hi3861V100 -DCHIP_VER_Hi3861 -DPRODUCT_CFG_SOFT_VER_STR=Hi3861 -DHI_BOARD_ASIC -DHI_ON_FLASH -DLITEOS_WIFI_IOT_VERSION -march=rv32imac -fno-common -fno-builtin -fno-strict-aliasing -Wall -fsigned-char -fstack-protector-all -std=c99 -c ../../../applications/sample/wifi-iot/app/pwm_demo/pwm_led.c -o obj/applications/sample/wifi-iot/app/pwm_demo/libpwm_demo.pwm_led.o
[OHOS ERROR] ../../../applications/sample/wifi-iot/app/pwm_demo/pwm_led.c:12:10: fatal error: iot_gpio.h: No such file or directory
[OHOS ERROR]  #include "iot_gpio.h"
[OHOS ERROR]           ^~~~~~~~~~~~
[OHOS ERROR] compilation terminated.
[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "/oh/4.0/build/hb/services/ninja.py", line 49, in _execute_ninja_cmd
[OHOS ERROR]     SystemUtil.exec_command(
[OHOS ERROR]   File "/oh/4.0/build/hb/util/system_util.py", line 63, in exec_command
[OHOS ERROR]     raise OHOSException(
[OHOS ERROR] exceptions.ohos_exception.OHOSException: Please check build log in /oh/4.0/out/hispark_pegasus/wifiiot_hispark_pegasus/build.log
[OHOS ERROR]
[OHOS ERROR] During handling of the above exception, another exception occurred:
[OHOS ERROR]
[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "/oh/4.0/build/hb/containers/status.py", line 47, in wrapper
[OHOS ERROR]     return func(*args, **kwargs)
[OHOS ERROR]   File "/oh/4.0/build/hb/modules/ohos_build_module.py", line 67, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/oh/4.0/build/hb/modules/ohos_build_module.py", line 65, in run
[OHOS ERROR]     super().run()
[OHOS ERROR]   File "/oh/4.0/build/hb/modules/interface/build_module_interface.py", line 72, in run
[OHOS ERROR]     raise exception
[OHOS ERROR]   File "/oh/4.0/build/hb/modules/interface/build_module_interface.py", line 70, in run
[OHOS ERROR]     self._target_compilation()
[OHOS ERROR]   File "/oh/4.0/build/hb/modules/ohos_build_module.py", line 103, in _target_compilation
[OHOS ERROR]     self.target_compiler.run()
[OHOS ERROR]   File "/oh/4.0/build/hb/services/ninja.py", line 38, in run
[OHOS ERROR]     self._execute_ninja_cmd()
[OHOS ERROR]   File "/oh/4.0/build/hb/services/ninja.py", line 52, in _execute_ninja_cmd
[OHOS ERROR]     raise OHOSException('ninja phase failed', '4000')
[OHOS ERROR] exceptions.ohos_exception.OHOSException: ninja phase failed
[OHOS ERROR]
[OHOS ERROR] Code:      4000
[OHOS ERROR]
[OHOS ERROR] Reason:    ninja phase failed
[OHOS ERROR]
[OHOS ERROR] Solution:  Please check the compile log at out/{compiling product}/build.log, If you could analyze build logs.
[OHOS ERROR]                 Or you can try the following steps to solve this problem:
[OHOS ERROR]                   1. cd to OHOS root path
[OHOS ERROR]                   2. run 'hb clean --all' or 'rm -rf out build/resources/args/*.json'.
[OHOS ERROR]                   3. repo sync
[OHOS ERROR]                   4. repo forall -c 'git lfs pull'
[OHOS ERROR]                   5. bash build/prebuilts_download.sh
[OHOS ERROR]                   6. rebuild your product or component
[OHOS ERROR]
[OHOS ERROR]                 If you still cannot solve this problem, you could post this problem on:
[OHOS ERROR]                   https://gitee.com/openharmony/build/issues
[OHOS ERROR]

```
[/md]
作者: Desto    时间: 2023-11-30 14:18
[md]./base/iothardware/peripheral/interfaces/inner_api/iot_gpio.h

你要找的应该是这个
[/md]
作者: dragon    时间: 2023-11-30 16:26
标题: fatal error: iot_gpio.h: No such file or directory
这个应该是你的BUILD.gn中没有加入相关头文件路径。
在你的代码的BUILD.gn中,加入iot_gpio.h所在路径:
static_library("app1") {
    sources = [
        "xxx.c"
    ]

    include_dirs = [
        ......
        "//base/iothardware/peripheral/interfaces/inner_api",
    ]
}







欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5