首页 > 解决方案 > 我应该使用什么 makefile 来构建 gtk-3-examples 应用程序?

问题描述

我对图形编程并不是很有经验,但我很好奇。我在我的 Debian 10.7 机器上安装了libgtk-3-devgtk-3-examples 。从那里我列出了dpkg-query -L gtk-3-examples用于查找一些示例程序的示例包文件。

在示例目录中,我找到了以下 README 文件:

== Building the examples ==

The examples in this directory are built alongside the rest of GTK+.

The examples under the `application[1-10]` directories are also included in
the GTK+ API reference documentation, and can be built independently, using
the system libraries, by doing:

    $ cd application1
    $ make -f Makefile.example

向前看。但是,完全按照指示会产生以下结果:

make: Makefile.example: No such file or directory
make: *** No rule to make target 'Makefile.example'.  Stop.

应用程序文件夹中没有“Makefile.example”文件。find -name "Makefile*"在示例目录中运行会产生:

./application7/Makefile.in.gz
./application7/Makefile.am
./Makefile.in.gz
./application5/Makefile.in.gz
./application5/Makefile.am
./bp/Makefile.in.gz
./bp/Makefile.am
./application9/Makefile.in.gz
./application9/Makefile.am
./application6/Makefile.in.gz
./application6/Makefile.am
./application2/Makefile.in.gz
./application2/Makefile.am
./application10/Makefile.in.gz
./application10/Makefile.am
./application3/Makefile.in.gz
./application3/Makefile.am
./application1/Makefile.in.gz
./application1/Makefile.am
./application8/Makefile.in.gz
./application8/Makefile.am
./application4/Makefile.in.gz
./application4/Makefile.am
./Makefile.am

我没有任何运气使用上述文件构建示例程序。我猜是因为我不熟悉汽车工具?有没有一种简单的方法可以使用上述文件构建示例 GTK 程序,或者我是否需要更多地了解 make/autotools/configure 才能运行一个工作示例?

更新:

cant-run-makefile-am-what-should-i-do帖子提供了丰富的信息,但在包中找不到配置、引导或自动生成程序时不提供操作过程。以下命令在我的示例目录中执行时不会产生任何结果: find -type f | grep -i -E "*conf*|*auto*|*boot*". 我需要提供其中一个文件才能成功构建(据我所知)。

标签: makefilegtk3automake

解决方案


对不起大惊小怪!我习惯于安装常规软件包并且错过了我需要下载完整的源代码才能使示例正常工作。所以,最初我提到我安装了libgtk-3-devgtk-3-examples。我这样做是使用apt-get install libgtk-3-dev && apt-get install gtk-3-examples.

但是,要在本地构建 GTK 及其示例,看起来您想要做的是获取源包存档apt-get source gtk-3-examples(或类似的..我认为当我运行该命令时它实际上为我选择了不同的元包)。

然后,在我的新gtk+3.0-3.24.5目录中,有一个很好的配置二进制文件,我可以运行它(使用后续makemake install命令),它会生成许多文件,包括示例程序二进制文件。

因此,./gtk+3.0-3.24.5/examples/application1/exampleapp我得到了一个正在运行的示例。瞧!

示例1


推荐阅读