Напиши программу на C с помощью библиотеки G2. Расставить на стандартной 64-клеточной…
- User
Напиши программу на C с помощью библиотеки G2. Расставить на стандартной 64-клеточной шахматной доске 8 ферзей так, чтобы ни один из них не находился под боем другого. Найдите количество решений и изобразите одно из них по выбору пользователя.
- Assistant
- User
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc g2.c -o g2 -L/usr/local/lib -lg2 -lm -lX11 g2.c: In function ‘draw_chessboard’: g2.c:51:15: warning: implicit declaration of function ‘g2_open_xwindows’ [-Wimplicit-function-declaration] 51 | int dev = g2_open_xwindows(100, 100, 400, 400, "8 Queens Problem"); | ^~~~~~~~~~~~~~~~ g2.c:58:17: warning: implicit declaration of function ‘g2_fill_rectangle’; did you mean ‘g2_filled_rectangle’? [-Wimplicit-function-declaration] 58 | g2_fill_rectangle(dev, j * 50, i * 50, 50, 50); | ^~~~~~~~~~~~~~~~~ | g2_filled_rectangle g2.c:63:17: warning: implicit declaration of function ‘g2_fill_circle’; did you mean ‘g2_filled_circle’? [-Wimplicit-function-declaration] 63 | g2_fill_circle(dev, j * 50 + 25, i * 50 + 25, 20); | ^~~~~~~~~~~~~~ | g2_filled_circle g2.c:69:5: warning: implicit declaration of function ‘g2_get_key’ [-Wimplicit-function-declaration] 69 | g2_get_key(); // ждет нажатия клавиши | ^~~~~~~~~~ /usr/bin/ld: cannot find -lX11: No such file or directory collect2: error: ld returned 1 exit status
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc g2.c -o g2 -L/usr/local/lib -lg2 -lm -lX11 g2.c: In function ‘draw_chessboard’: g2.c:51:15: warning: implicit declaration of function ‘g2_open’; did you mean ‘g2_pen’? [-Wimplicit-function-declaration] 51 | int dev = g2_open(600, 600); // Открытие окна | ^~~~~~~ | g2_pen g2.c:52:5: error: too few arguments to function ‘g2_clear’ 52 | g2_clear(); // Очистка экрана | ^~~~~~~~ In file included from g2.c:4: /usr/local/include/g2.h:126:10: note: declared here 126 | G2L void g2_clear(int dev); | ^~~~~~~~ g2.c:58:17: warning: implicit declaration of function ‘g2_set_fill_color’ [-Wimplicit-function-declaration] 58 | g2_set_fill_color(255, 255, 255); // Белый цвет | ^~~~~~~~~~~~~~~~~ g2.c:62:13: warning: implicit declaration of function ‘g2_fill_rectangle’; did you mean ‘g2_filled_rectangle’? [-Wimplicit-function-declaration] 62 | g2_fill_rectangle(j * 60, i * 60, 60, 60); | ^~~~~~~~~~~~~~~~~ | g2_filled_rectangle g2.c:65:17: warning: implicit declaration of function ‘g2_fill_circle’; did you mean ‘g2_filled_circle’? [-Wimplicit-function-declaration] 65 | g2_fill_circle(j * 60 + 30, i * 60 + 30, 20); | ^~~~~~~~~~~~~~ | g2_filled_circle g2.c:70:5: error: too few arguments to function ‘g2_flush’ 70 | g2_flush(); // Обновление окна | ^~~~~~~~ In file included from g2.c:4: /usr/local/include/g2.h:109:10: note: declared here 109 | G2L void g2_flush(int dev); | ^~~~~~~~ g2.c:71:5: warning: implicit declaration of function ‘g2_get_key’ [-Wimplicit-function-declaration] 71 | g2_get_key(); // Ждет нажатия клавиши | ^~~~~~~~~~ g2.c:72:5: error: too few arguments to function ‘g2_close’ 72 | g2_close(); // Закрытие окна | ^~~~~~~~ In file included from g2.c:4: /usr/local/include/g2.h:107:10: note: declared here 107 | G2L void g2_close(int dev); | ^~~~~~~~ root@ubuntu:/home/galat/Downloads#
- Assistant
- User
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc g2.c -o g2 -L/usr/local/lib -lg2 -lm -lX11 g2.c: In function ‘draw_chessboard’: g2.c:51:15: warning: implicit declaration of function ‘g2_open_xwindows’ [-Wimplicit-function-declaration] 51 | int dev = g2_open_xwindows(100, 100, 400, 400, "8 Queens Problem"); | ^~~~~~~~~~~~~~~~ g2.c:59:17: warning: implicit declaration of function ‘g2_set_fill_color’ [-Wimplicit-function-declaration] 59 | g2_set_fill_color(255, 255, 255); // Белый цвет | ^~~~~~~~~~~~~~~~~ g2.c:63:13: warning: implicit declaration of function ‘g2_fill_rectangle’; did you mean ‘g2_filled_rectangle’? [-Wimplicit-function-declaration] 63 | g2_fill_rectangle(dev, j * 50, i * 50, 50, 50); | ^~~~~~~~~~~~~~~~~ | g2_filled_rectangle g2.c:69:17: warning: implicit declaration of function ‘g2_fill_circle’; did you mean ‘g2_filled_circle’? [-Wimplicit-function-declaration] 69 | g2_fill_circle(dev, j * 50 + 25, i * 50 + 25, 15); | ^~~~~~~~~~~~~~ | g2_filled_circle g2.c:75:5: warning: implicit declaration of function ‘g2_get_key’ [-Wimplicit-function-declaration] 75 | g2_get_key(); // Ждет нажатия клавиши | ^~~~~~~~~~ /usr/bin/ld: /tmp/ccW9Y4zm.o: in function g2_open_xwindows' /usr/bin/ld: g2.c:(.text+0x29f): undefined reference to g2_set_fill_color' /usr/bin/ld: g2.c:(.text+0x2e0): undefined reference to g2_set_fill_color' /usr/bin/ld: g2.c:(.text+0x35b): undefined reference to g2_get_key' collect2: error: ld returned 1 exit status root@ubuntu:/home/galat/Downloads#
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.