openharmony3.0头文件问题

我在code-3.0源码上编译oled例程时发现,build.gn中include头文件路径并不正确,但是能够编译成功,后来我干脆把include包含的头文件路径全删了,编译还是能够成功。

我又在code-1.0源码上尝试同样的操作,编译报错。

openharmony源码中头文件是怎样引用的,问啥在code-3.0中删除了build.gn中的头文件也能正常编译?

问题求助
2022-01-12 10:30:23
浏览
1
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
鸿蒙开发初学者
1

搞清楚了,在code-3.0中由config.gni为开发板编译相关的配置,编译时会采用该配置文件中的参数编译所有OS组件,编译阶段系统全局可见。在config.gni中包含了很多头文件,常用的基本包含在内了,如下所示:

# Board related headfiles search path.
board_include_dirs = [
  "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/include",
  "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/include",
  "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/system/include",
  "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/config",
  "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/config/nv",
  "${ohos_root_path}utils/native/lite/include",
  "${ohos_root_path}device/hisilicon/hispark_pegasus/hi3861_adapter/kal/cmsis",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/kernel/base/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/kernel/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/arch/risc-v/rv32im",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libm/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libsec/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/net/wpa_supplicant-2.7/src/common",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/plat/riscv",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/kernel/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/kernel/extended/runstop",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/posix/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/linux/include",
  "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/third_party/lwip_sack/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/musl/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/generic",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/riscv32",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/hw/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/nuttx/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libsec/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/config",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/user",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/plat",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/targets/hi3861v100/extend/include",
  "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/arch",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/components/lib/libc/bionic/libm",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/shell/include",
 "${ohos_root_path}device/hisilicon/hispark_pegasus/sdk_liteos/platform/os/Huawei_LiteOS/net/telnet/include",
]

分享
微博
QQ
微信
回复
2022-01-12 13:04:15
相关问题
OpenHarmony 3.0 LTS camera驱动
4039浏览 • 0回复 待解决
HarmonyOS提供的头文件
268浏览 • 1回复 待解决
HarmonyOS har包无法封装头文件
277浏览 • 1回复 待解决
HarmonyOS是否可以申明多个头文件
354浏览 • 1回复 待解决
ndk中没有native camera对应头文件
1756浏览 • 1回复 待解决
Native侧如何引入头文件deviceinfo.h
1745浏览 • 1回复 待解决
基于HAR的跨模块C++头文件引用
729浏览 • 1回复 待解决
openharmony 3.0LTS 中liteos-a支持I2S输出吗
6252浏览 • 1回复 待解决
openHarmony2.0 hb编译问题
10863浏览 • 5回复 待解决
OpenHarmony应用使用NativeC++无法读文件
2144浏览 • 0回复 待解决
openHarmony 注册服务中的语法问题
7024浏览 • 1回复 待解决
openharmony 基于arkts的socket连接问题
3994浏览 • 1回复 待解决
提问
该提问已有0人参与 ,帮助了0人