Wayland入门教程08.04:hello world

系列索引地址:Wayland入门教程索引

上一篇:Wayland入门教程08.03:调试工具

废话说完了,接下来正式进入开发流程,一般编程开发的第一步就是Hello World

本文主要测试Wayland的头文件、库能否正确链接。

测试代码

1
2
3
4
5
6
7
8
9
10
11
12
#include <wayland-server.h>
#include <wayland-client.h>
#include <wayland-egl.h>
#include <wayland-cursor.h>
#include <wayland-util.h>

#include <stdio.h>

int main()
{
printf("Hello world\n");
}

编译方法

Makefile

1
2
all:
gcc -o helloworld helloworld.c -lwayland-client -lwayland-server -lwayland-cursor -lwayland-egl

编译运行

1
2
3
4
hyper@ubuntu:~/Nutstore Files/Nutstore/Wayland$ make
gcc -o helloworld helloworld.c -lwayland-client -lwayland-server -lwayland-cursor -lwayland-egl
hyper@ubuntu:~/Nutstore Files/Nutstore/Wayland$ ./helloworld
Hello world

没有报错、没有异常,表示wayland相关头文件和库文件位置包含没有错。

完整代码在Wayland_Freshman下的08.04.hellow world中。

下一篇:Wayland入门教程08.05:连接server


Wayland入门教程08.04:hello world
https://feater.top/wayland/wayland-hello-world/
作者
JackeyLea
发布于
2021年9月27日
许可协议