我非常感谢帮助在Fedora 30上运行“ gtkmm-3.0”(Gtk + 3库的C ++接口)。在Fedora 29上我没有问题。
我使用以下命令安装了gtkmm:
dnf install gtk3 gtk3-devel gtkmm30 gtkmm30-devel
为了测试它,我使用了网络上常见的简单.cpp文件,例如 https://gtkmm-tutorial.blogspot.com/2016/05/how-to-install-gtkmm-on-CENTOS-7-RedHat-Fedora-in-3-steps.html
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
Gtk::Window GtkmmTutorial;
GtkmmTutorial.set_default_size(400, 400);
Gtk::Main::run(GtkmmTutorial);
return 0;
}
给出文件名“ GtkmmTutorial.cpp”,我使用以下命令从同一目录编译它:
g++ GtkmmTutorial.cpp -o GtkmmTutorial `pkg-config gtkmm-3.0 --cflags --libs`
编译失败,并显示以下错误消息:
Package gtkmm-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtkmm-3.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtkmm-3.0', required by 'virtual:world', not found
GtkmmTutorial.cpp:1:10: fatal error: gtkmm.h: No such file or directory
1 | #include <gtkmm.h>
| ^~~~~~~~~
compilation terminated.
我在“ / usr / lib / pkgconfig /”中找到了gtkmm-3.0.pc和gdkmm-3.0.pc,所以按照指示进行了操作:
export PKG_CONFIG_PATH="/usr/share/pkgconfig"
下次尝试编译时,出现以下错误消息:
/usr/bin/ld: skipping incompatible /usr/lib/libgtkmm-3.0.so when searching for -lgtkmm-3.0
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/9/../../../libgtkmm-3.0.so when searching for -lgtkmm-3.0
/usr/bin/ld: skipping incompatible //lib/libgtkmm-3.0.so when searching for -lgtkmm-3.0
/usr/bin/ld: skipping incompatible //usr/lib/libgtkmm-3.0.so when searching for -lgtkmm-3.0
/usr/bin/ld: cannot find -lgtkmm-3.0
/usr/bin/ld: skipping incompatible /usr/lib/libgdkmm-3.0.so when searching for -lgdkmm-3.0
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/9/../../../libgdkmm-3.0.so when searching for -lgdkmm-3.0
/usr/bin/ld: skipping incompatible //lib/libgdkmm-3.0.so when searching for -lgdkmm-3.0
/usr/bin/ld: skipping incompatible //usr/lib/libgdkmm-3.0.so when searching for -lgdkmm-3.0
/usr/bin/ld: cannot find -lgdkmm-3.0
collect2: error: ld returned 1 exit status
我的F30或F29系统上没有文件“ lgtkmm-3.0”或“ lgdkmm-3.0”(它们具有几乎相同的.pc文件,但版本号略有不同)。我也无法在网上找到此类文件。
不确定下一步要去哪里...谢谢您的投入。