Author: HonestQiao 乔帮主的docker环境适用于套件使用,具体参考网址:https://blog.51cto.com/harmonyos/5223948
安装remote – container插件:
安装完成后,在VSCode的左下角出现一个绿色的按钮
连接到container中点击attach to Running Container…
Attach到container以后,可以看到内部的文件系统:
这样就能正常开发了
用VScoder打开路径:/home/dist/OpenHarmony-v3.1-Release/applications/sample/wifi-iot/app
/app/BUILD.gn
import("//build/lite/config/component/lite_component.gni")
lite_component("app") {
features = [
#"startup",
"myshow:myshow",
]
}
static_library("myshow") {
sources = [
"myshow.c"
]
include_dirs = [
"//utils/native/lite/include",
"//kernel/liteos_m/kal/cmsis",
"//base/iot_hardware/peripheral/interfaces/kits",
]
}
myshow.c
#include <stdio.h>
#include <unistd.h>
#include "ohos_init.h"
#include "cmsis_os2.h"
#include "iot_gpio.h"
void mymain(void)
{
printf("[DEMO] Hello world.\n");
}
SYS_RUN(mymain);
至此可以愉快的进行开发了。