Напиши программу на C с помощью библиотеки g2.h и g2X11.h. Расставить на стандартной…
- User
Напиши программу на C с помощью библиотеки g2.h и g2_X11.h. Расставить на стандартной 64-клеточной шахматной доске 8 ферзей так, чтобы ни один из них не находился под боем другого. Найдите количество решений и изобразите одно из них по выбору пользователя. Вот команды, которые используются в библиотеки: g2_filled_rectangle g2_string g2_image g2_open_X11
- Assistant
- User
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 g2.c: In function ‘draw_board’: g2.c:38:5: error: too few arguments to function ‘g2_filled_rectangle’ 38 | g2_filled_rectangle(0, 0, 400, 400); // Очищаем экран | ^~~~~~~~~~~~~~~~~~~ In file included from g2.c:3: /usr/local/include/g2.h:145:10: note: declared here 145 | G2L void g2_filled_rectangle(int dev, | ^~~~~~~~~~~~~~~~~~~ root@ubuntu:/home/galat/Downloads#
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 g2.c: In function ‘draw_board’: g2.c:38:5: error: too few arguments to function ‘g2_filled_rectangle’ 38 | g2_filled_rectangle(0, 0, 400, 400); // Очищаем экран (отображаем весь экран) | ^~~~~~~~~~~~~~~~~~~ In file included from g2.c:3: /usr/local/include/g2.h:145:10: note: declared here 145 | G2L void g2_filled_rectangle(int dev, | ^~~~~~~~~~~~~~~~~~~
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 g2.c: In function ‘draw_board’: g2.c:41:5: error: too few arguments to function ‘g2_filled_rectangle’ 41 | g2_filled_rectangle(0, 0, 400, 400); // Очищаем экран | ^~~~~~~~~~~~~~~~~~~ In file included from g2.c:3: /usr/local/include/g2.h:145:10: note: declared here 145 | G2L void g2_filled_rectangle(int dev, | ^~~~~~~~~~~~~~~~~~~
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 g2.c: In function ‘draw_board’: g2.c:42:5: error: too few arguments to function ‘g2_filled_rectangle’ 42 | g2_filled_rectangle(0, 0, 400, 400); // Очистка окна | ^~~~~~~~~~~~~~~~~~~ In file included from g2.c:3: /usr/local/include/g2.h:145:10: note: declared here 145 | G2L void g2_filled_rectangle(int dev, | ^~~~~~~~~~~~~~~~~~~
- Assistant
- User
в g2_filled_rectangle() 6 аргументов должно быть
- Assistant
- User
Сделай все чтобы заработало, можешь просто переделать все главное чтоб работало
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 g2.c: In function ‘draw_board’: g2.c:42:5: error: too many arguments to function ‘g2_filled_rectangle’ 42 | g2_filled_rectangle(0, 0, 0, 400, 400, 0); // Чёрный фон | ^~~~~~~~~~~~~~~~~~~ In file included from g2.c:3: /usr/local/include/g2.h:145:10: note: declared here 145 | G2L void g2_filled_rectangle(int dev, | ^~~~~~~~~~~~~~~~~~~ g2.c:51:13: error: too many arguments to function ‘g2_filled_rectangle’ 51 | g2_filled_rectangle(0, x, y, 50, 50, color); // Используем 0 или 1 для цветов | ^~~~~~~~~~~~~~~~~~~ In file included from g2.c:3: /usr/local/include/g2.h:145:10: note: declared here 145 | G2L void g2_filled_rectangle(int dev, | ^~~~~~~~~~~~~~~~~~~ root@ubuntu:/home/galat/Downloads# Оно не работает. Ну сделай пожалуйста как надо
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 g2.c: In function ‘draw_board’: g2.c:41:5: error: too few arguments to function ‘g2_filled_rectangle’ 41 | g2_filled_rectangle(0, 0, 400, 400); // Очищаем экран | ^~~~~~~~~~~~~~~~~~~ In file included from g2.c:3: /usr/local/include/g2.h:145:10: note: declared here 145 | G2L void g2_filled_rectangle(int dev, | ^~~~~~~~~~~~~~~~~~~ root@ubuntu:/home/galat/Downloads# Сделай как надо. Я уже устал. Просто сделай так чтобы не было никаких ошибок
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 root@ubuntu:/home/galat/Downloads# ./g2 Finding solutions for the 8 queens problem... Total solutions found: 92 g2: can not load font: '--times-medium-r-normal--12-------' g2: are you sure about 12 point size g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 Press Enter to exit. Рисуется черный фон. Сделай как надо
- Assistant
- User
root@ubuntu:/home/galat/Downloads# ./g2 Finding solutions for the 8 queens problem... Total solutions found: 92 g2: can not load font: '--times-medium-r-normal--12-------' g2: are you sure about 12 point size g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 Press Enter to exit.
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 -lg2_X11 ./g2 /usr/bin/ld: cannot find -lg2_X11: No such file or directory collect2: error: ld returned 1 exit status bash: ./g2: No such file or directory root@ubuntu:/home/galat/Downloads#
- Assistant
Ошибка, которую вы видите, указывает на то, что компилятор не может найти библиотеку
g2_X11. Это может быть связано с тем, что библиотека установлена под другим именем, или что она не установлена на вашей системе вовсе.Шаги для устранения проблемы
-
Убедитесь, что библиотеки g2 установлены: Вам нужно установить необходимые библиотеки. Если вы еще не установили их, вы можете попробовать выполнить следующее (для Ubuntu или Debian):
sudo apt-get update sudo apt-get install libg2-devПосле установки проверьте, находится ли библиотека
g2.hиlibg2.soв/usr/local/includeи/usr/local/lib.
-
- User
root@ubuntu:/home/galat/Downloads# ./g2 Finding solutions for the 8 queens problem... Total solutions found: 92 g2: can not load font: '--times-medium-r-normal--12-------' g2: are you sure about 12 point size g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 g2_filled_rectangle: No such device: 1 Press Enter to exit. Мне кажется я сейчас сдохну
- Assistant
- User
root@ubuntu:/home/galat/Downloads# sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable Reading package lists... Done Building dependency tree... Done Reading state information... Done xfonts-scalable is already the newest version (1:1.0.3-1.2ubuntu1). xfonts-100dpi is already the newest version (1:1.0.4+nmu1.1). xfonts-75dpi is already the newest version (1:1.0.4+nmu1.1). 0 upgraded, 0 newly installed, 0 to remove and 46 not upgraded. root@ubuntu:/home/galat/Downloads#
- Assistant
- User
root@ubuntu:/home/galat/Downloads# sudo xset fp- /usr/share/fonts/X11/misc/ xset: warning, no entries deleted from font path.
- Assistant
Похоже, что вы столкнулись с проблемами при попытке изменить путь к шрифтам X11. Давайте попробуем устранить эту проблему, а также исправить проблемы с графической библиотекой .
- User
Был нарисован черный фон
- Assistant
- User
root@ubuntu:/home/galat/Downloads# gcc -o g2 g2.c -lg2 root@ubuntu:/home/galat/Downloads# ./g2 g2_filled_rectangle: No such device: 1 g2_set_lsd: Warning! No such device: 3 Press Enter to exit.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.