Aşağıdaki kodu derlemeye çalışıyorum, ancak bana aşağıda listelendiği gibi bir hata mesajı veriyor. Linux c grafiklerinde yeni başlayan biriyim ve bunu anlayamıyorum. Birisi çözüm önerisi sunabilir mi?Linux Graphics C programında aşağıdaki hatayı nasıl çözebilirim?
kodu:
#include<stdio.h>
#include<graphics.h>
void main()
{
int gd = DETECT, gm;
int dx, dy, p, end;
float x1, x2, y1, y2, x, y;
initgraph(&gd, &gm,NULL);
printf("Enter Value of X1: ");
scanf("%f", &x1);
printf("Enter Value of Y1: ");
scanf("%f", &y1);
printf("Enter Value of X2: ");
scanf("%f", &x2);
printf("Enter Value of Y2: ");
scanf("%f", &y2);
dx = abs(x1 - x2);
dy = abs(y1 - y2);
p = 2 * dy - dx;
if(x1 > x2)
{
x = x2;
y = y2;
end = x1;
}
else
{
x = x1;
y = y1;
end = x2;
}
putpixel(x, y, 10);
while(x < end)
{
x = x + 1;
if(p < 0)
{
p = p + 2 * dy;
}
else
{
y = y + 1;
p = p + 2 * (dy - dx);
}
putpixel(x, y, 10);
}
getch();
closegraph();
}
hata iletisi:
[email protected]:~/libgraph-1.0.2$ ./b
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
b: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
b: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)
* graphics.h * sadece bir başlık dosyasıdır. Aslında kullandığınız şey * kütüphane *. Belki bunu belirttiğinizde daha fazla cevap alırsınız. – tofro
Bir resme bazı çizgiler çizmeye çalışıyorsanız, Magick ++ kullanabilirsiniz. Bunları başlatabilmeniz için https://www.imagemagick.org/Magick++/Image++.html ve http://www.imagemagick.org/Magick++/tutorial/Magick++_tutorial.pdf –
Başka bir seçenek 'libvga 'kullanmak olabilir http://stackoverflow.com/a/36529602/2836621 ve ayrıca http://www.svgalib.org adresindeki cevabıma bakın http://www.svgalib.org –