移植GTK3.0项目GTK2.0 [英] Porting GTK3.0 project to GTK2.0

查看:1853
本文介绍了移植GTK3.0项目GTK2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建设,我已经成功地部署和我树莓派开发板运行一个简单的GUI应用程序。然而,由于与OpenCV的依赖于GTK + 2.0版的问题,我必须回港我的应用程序的旧版本GTK +的。我已经熟悉了改变包括路径等,并库链接订单我的makefile。然而,当我做出所有必要的更改,构建过程中发生致命错误。

I am building a simple GUI application which I have successfully deployed and run on my Raspberry PI dev board. However, due to issues with OpenCV being dependent on GTK+ v2.0, I have to back-port my application to an old version of GTK+. I'm already familiar with changing include paths, and so on, and library linking orders in my makefiles. However, when I make all the necessary changes, a fatal error occurs during build.

Building dependencies file for main.o
In file included from /opt/rpi/usr/include/gtk-2.0/gdk/gdkscreen.h:32:0,
             from /opt/rpi/usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:31,
             from /opt/rpi/usr/include/gtk-2.0/gdk/gdk.h:32,
             from /opt/rpi/usr/include/gtk-2.0/gtk/gtk.h:32,
             from inc/ui.h:8,
             from main.c:10:
/opt/rpi/usr/include/gtk-2.0/gdk/gdktypes.h:55:23: fatal error:
   gdkconfig.h: No such file or directory

我已经确认丢失的文件, gdkconfig.h 存在我的GTK + V3.0安装:

I've confirmed that the missing file, gdkconfig.h exists for my GTK+ v3.0 installation:

find /opt/rpi/usr/include -iname "gdkconfig*"
./gtk-3.0/gdk/gdkconfig.h

但是,我的GTK + v2.0安装没有这样的文件。我已经安装了通过最新的apt-get ,但仍没有运气。

是对这个问题有什么解决办法?

Are there any solutions to this issue?

感谢您。

推荐答案

原来某些文件夹,包括那些 ARM-Linux的gnueabihf 的路径,不由我手动,包括当他们应该有。最后,我SSH'ed到RPI设备,并复制从以下命令的输出:

It turns out certain folders, including those with arm-linux-gnueabihf in the path, were not included by me manually, when they should have. In the end, I SSH'ed into the RPI device, and copied the output from the following command:

pkgconfig --clfags --libs gtk+-2.0

然后我复制了所有的include目录的语句(即:与 -I 开始),并提出含有大量的字符串,并没有对所有的图书馆类似的变量包括。从上面的命令的输出包含下面。

I then copied all the include directory statements (ie: those beginning with -I) and made a variable containing that massive string, and did something similar for all the library inclusions. The output from the above command is included below.

-pthread -I/usr/include/gtk-2.0 -I/usr/lib/arm-linux-gnueabihf/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0
-I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng12  -lgtk-x11-2.0 -lgdk-x11-2.0 
-latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0
-lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0

因此​​,简而言之,这个工作,我甚至没有改变我的code一行。现在,一切工作正常。

So, in short, this worked, and I didn't even have to change a single line of my code. Now everything works fine.

这篇关于移植GTK3.0项目GTK2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆