Код «HDSentinel.cpp» и «Hello World» опубликован ниже. Здесь нет текста, по которому нужно щелкнуть, и у кнопки нет черной границы. При нажатии в любом месте пустого окна выбирается кнопка:
Сначала «HDSentinel.cpp»:
Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
#include
// Function to execute a command with a graphical prompt for privileges
void execute_superuser_command(const std::string& command) {
// Prepend 'pkexec' to the command. Pkexec will handle the graphical password prompt.
std::string full_command = "pkexec " + command;
// Execute the command in the shell
int result = std::system(full_command.c_str());
if (result == 0) {
// Command executed successfully
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79858062/why-is-this-gtk-c-program-not-showing-a-button-with-a-black-rectangular-box-b[/url]
Мобильная версия