'%20%EC%84%A0%EC%96%B8%EC%9D%B4%20%EC%B6%A9%EB%8F%8C%ED%95%A9%EB%8B%88%EB%8B%A4..png)
내 Ubuntu 컴퓨터에서 다음 프로그램을 실행하려고 합니다.이 프로그램, 사용도서관BGI 기능에 대한 지원을 제공하기 위해:
#include <graphics.h>
#include <curses.h>
int main()
{
int gd = DETECT, gm, i;
initgraph(&gd, &gm, NULL);
int x,y=0,j,t=400,c=1;
setcolor(RED);
setlinestyle(0,0,1);
for(x=40;x<602;x++)
{
cleardevice();
circle(x,y,20);
floodfill(x,y,YELLOW);
delay(40);
if(y>=400)
{
c=0;
t-=20;
}
if(y<=(400-t))
c=1;
y=y+(c?15:-15);
}
getch();
}
튀는 공을 출력해야합니다. 하지만 컴파일하면 다음과 같은 오류가 발생합니다.
error: conflicting declaration of C function ‘int getmaxx(const WINDOW*)’
error: conflicting declaration of C function ‘int getmaxy(const WINDOW*)’
인터넷을 통해 검색해 보았지만 여전히 오류를 해결할 수 없습니다. 누군가 나를 도와줄 수 있나요?
답변1
나는 추천한다SDL_bgi이런 종류의 변환에서는 libgraph보다 유지 관리가 더 나은 것 같습니다. 이를 사용하여 #include <curses.h>
(선언 충돌의 원인이 되는) 줄을 제거하고 다음으로 빌드해야 합니다.
gcc bounce.c -lSDL_bgi $(pkg-config --libs sdl2) -o bounce