如何在OSX安装GTK与G ++ / gcc编译器的使用 [英] How to install gtk on OSX for use with g++/gcc compiler

查看:357
本文介绍了如何在OSX安装GTK与G ++ / gcc编译器的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经要求在apple.stackexchange.com 这个问题,但我被告知这是放错了地方对于这个问题 - 所以我会问在这里,我建议做

I already asked this question at apple.stackexchange.com, but I was told it was the wrong place for this question - so I will ask it here, as I was suggested to do.

在我的大学,我们得实现一个C程序具有GTK的GUI任务。在GTK的GUI已经实现,我们只需要实现一个算法,它手中的一些数据。

At my university we got the task to implement a c-program which has a GTK-GUI. The GTK-GUI is already implemented, we just have to implement a algorithm which hands it some data.

我已经得到了GCC / G ++的工作。但是,当我试图编译编译器返回错误的项目,它没有找到GTK:

I already got gcc/g++ working. But when i try to compile the project the compiler returns the error, that it does not find the gtk:

fatal error: 'gtk/gtk.h' file not found
#include <gtk/gtk.h>
         ^

所以我的问题是:
如何在OSX小牛安装GTK使用它使用gcc / g ++的编译器?

So my question is: How do I install gtk on OSX Mavericks for using it with gcc/g++ compiler?

我的设置:MacBook Pro的视网膜中间2012年OSX小牛。自制安装并工作,如果它可能是用于安装有用

My setup: MacBook Pro Retina Mid 2012 with OSX Mavericks. Homebrew is installed and working if it could be useful for the installation.

(当然苹果命令行开发工具被安装)

(Of course the Apple Command Line Developer Tools are installed)

推荐答案

我终于解决了这个问题。 tojanfoe在评论中所建议的链接的http://www.hard$c$cd.net/devlogs/20120426 这竟然不是会有所帮助。

I finally solved the Problem. tojanfoe suggested in a comment the link http://www.hardcoded.net/devlogs/20120426 which turned out to not be helpful.

这是我如何解决它:

1.A)GTK + 2.X的安装:

1.a) Installation of GTK+ 2.x:

brew install gtk+

1.B)GTK + 3.X的安装:

1.b) Installation of GTK+ 3.x:

您可以通过家酿安装GTK + 3.x的太多,如果你需要,但在2.x版本就够了我的目的。该命令是:

You can install gtk+ 3.x via home brew too if you need that, but the 2.x version is enough for my purposes. The command would be:

brew install gtk+3

2)。
但安装我有问题后,开罗找不到。所以,我解决了它这种方式:

2.) But after the installation I had the problem, that cairo could not be found. So i solved it this way:

export PKG_CONFIG_PATH=/usr/local/Cellar/cairo/1.12.16/lib/pkgconfig/

3)。
那么编译器表示无法找到包'XCB-SHM,通过开罗要求。这可以解决这样的:

3.) Then the compiler said it could not find the package 'xcb-shm', required by 'cairo'. This can be solved this way:

export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

在此命令的编译器工作正常。

After this command the compiler worked as expected.

这篇关于如何在OSX安装GTK与G ++ / gcc编译器的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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