新手问题:OSX上的GTK#(单声道) [英] Newbie Question: GTK# (Mono) on OSX

查看:93
本文介绍了新手问题:OSX上的GTK#(单声道)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在GTK中执行第一步(或者也许是我的最后一步) #在OSX的Mono上.我写了一个.cs文件,然后尝试使用mono进行编译:

I am taking my first steps (or perhaps my last steps) in GTK# on Mono for OSX. I write a .cs file and then try to compile with mono:

gmcs -pkg:gtk-sharp-2.0 one.cs

这导致出现此消息

error CS8027: Couldn't run pkg-config: ApplicationName='pkg-config', CommandLine='--libs gtk-sharp-2.0', CurrentDirectory=''

显然,这将要求我知道我在做什么.我知道

Which would, apparently, require me to know what I'm doing. I do know that

Mono的MacOS X安装程序随附 使用Gtk +和Gtk#,因此您可以开始 建立和运行跨平台 GUI Gtk#应用程序包括 OSX."

Mono's Installer for MacOS X comes with Gtk+ and Gtk# so you can start building and running cross-platform GUI Gtk# applications that include OSX."

因此没有任何安装.

<罢工> 我在这里确实找到了GTK2

I do find GTK2 here

/opt/local/var/macports/sources/rsync.macports.org/release/ports/x11/gtk2/

肯定是由Mono安装程序安装的.

which was definitely installed by the Mono installation.

Gmcs版本是2.4.2.2.

Gmcs version is 2.4.2.2.

编辑:Miguel说我的路线有些奇怪.

Miguel says I have something weird in my path.

我已按照Macports的说明删除了所有Macports.我已经从.dmg重新安装了Mono.这是我当前的路径

I have removed all Macports following Macports instructions. I have reinstalled Mono from the .dmg. Here is my current path

export PATH=/opt/subversion:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin

但是即使仅使用/usr/bin,它仍然不能避免错误.

but even if use just /usr/bin it's still not avoiding the error.

所有Mono的东西都应该在其中,包括/Library/Frameworks/Mono.framework/Versions/Current中的所有东西. 但是:很奇怪

ALL Mono stuff is where it's supposed to be, including all the stuff in /Library/Frameworks/Mono.framework/Versions/Current. HOWEVER: strangely

/Library/Frameworks/Mono.framework/Versions/2.4.2.2/lib/gtk-sharp-2.0/ 

为空.但是MonoDevelop可以运行,但是不了解Gtk(我已经包含了它所知道的所有参考)...

is empty. But MonoDevelop runs, but doesn't know about Gtk (I've included all the references it knows about)...

推荐答案

快速而肮脏的解决方案:

Quick and dirty solution:

cd /usr/local/bin
sudo ln -s /Library/Frameworks/Mono.framework/Commands/pkg-config ./pkg-config

现在,您的gmcs -pkg:...命令将起作用.

Now your gmcs -pkg:... command will work.

背景:我在新的Mac和全新安装的Mono上遇到了这个确切的问题.让我挠头呆了几天,直到我仔细查看错误消息:

Background: I hit this exact problem on a new Mac and a fresh install of Mono. Left me scratching my head for a few days until I took a close look at the error message:

error CS8027: Couldn't run pkg-config: ApplicationName='pkg-config', CommandLine='--libs gtk-sharp-2.0', CurrentDirectory=''

是说它无法运行程序,所以我做了一个

It's saying it couldn't run the program, so I did a

which pkg-config

那是空白,所以我认为它可能无法运行,因为它不在路上.事实就是如此.

That came up blank, so I thought probably it couldn't run it because it wasn't in the path. And that turned out to be it.

这篇关于新手问题:OSX上的GTK#(单声道)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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