我想<graphics.h>
在 VsCode 中运行。为此,我下载了 3 个文件(graphics.h、winbgim.h 和 libbgi.a)并将它们粘贴到各自的文件夹中,并且 graphics.h 下的 sqqiggly 行不再出现。但是当我去执行以下代码时 -
#include<graphics.h>
int main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,(char*)"");
circle(200,200,100);
line(200,500,45,485);
getch();
closegraph();
return 0;
}
错误弹出如下 -
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\me\Documents\C++ programs> cd "c:\Users\me\Documents\C++ programs\graphics\" ; if ($?) { g++ temp.cpp -o temp } ; if ($?) { .\temp }
C:\Users\me\AppData\Local\Temp\ccLUwEoL.o:temp.cpp:(.text+0x27): undefined reference to `initgraph'
C:\Users\me\AppData\Local\Temp\ccLUwEoL.o:temp.cpp:(.text+0x3c): undefined reference to `circle'
C:\Users\me\AppData\Local\Temp\ccLUwEoL.o:temp.cpp:(.text+0x57): undefined reference to `line'
C:\Users\me\AppData\Local\Temp\ccLUwEoL.o:temp.cpp:(.text+0x66): undefined reference to `closegraph'
collect2.exe: error: ld returned 1 exit status
谁能告诉我我做错了什么?现在我也无法安装 dev c++ 或代码块,因为几天前卸载它们的过程很混乱。