1、下载库文件
easyx.cn/download/ea… 解压后如下:
2、复制库文件
1)把lib64文件夹中的libeasyx.a复制到\x86_64-w64-mingw32\include中的lib中;
2)把include文件夹中的easyx.h和graphics.h复制到mingw64中的include中;
3、修改tasks.json文件
在args下面新增:
"-L", // 在库文件的搜索路径列表中添加dir目录
"F:\\c\\source\\mingw64\\lib",
"-leasyx"
4、调试程序
#include<graphics.h>
#include<stdio.h>
#include <conio.h>
int main() {
// 初始化绘图窗口
initgraph(640, 480);
// 设置背景色为蓝色
setbkcolor(BLUE);
// 用背景色清空屏幕
cleardevice();
// 设置绘图色为红色
setcolor(RED);
// 画矩形
rectangle(100, 100, 300, 300);
// 按任意键退出
_getch();
closegraph();
return 0;
}