DragonOS/docs/userland/appdev/c-cpp-quick-start.md

16 lines
490 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 为DragonOS开发C/C++应用
## 编译环境
  DragonOS与Linux具有部分二进制兼容性因此可以使用Linux的musl-gcc进行编译。但是由于DragonOS还不支持动态链接
因此要增加编译参数`-static`
比如,您可以使用
```shell
musl-gcc -static -o hello hello.c
```
来编译一个hello.c文件。
在移植现有程序时,可能需要配置`CFLAGS``LDFLAGS`,以及`CPPFLAGS`,以便正确地编译,具体请以实际为准。