单声道在OSX上:找不到gtksharpglue-2.dll [英] Mono on OSX: Couldn't find gtksharpglue-2.dll

查看:148
本文介绍了单声道在OSX上:找不到gtksharpglue-2.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在C#中完成我的第一步,并希望构建一个空的GTK窗口作为我的第一个任务。通过 macports 我安装了以下软件包:




  • mono@2.10.9

  • gtk-sharp@1.0.10

  • gtk-sharp2@2.12.10


我也使用Mono主页中的MonoDevelop。



我添加了 gtk-sharp.dll (从 /opt/local/lib/mono/gtk-sharp-2.0 )到我的参考。
我的代码如下所示:

  using System; 
使用Gtk;

命名空间lolbr_client
{
class MainClass
{
public static void Main(string [] args)
{
Console .WriteLine( 中..);
窗口窗口=新窗口(测试);
}
}
}

当我编译并运行代码片段,它似乎找到并包含GTK库,它将Loading ..打印到控制台,但是 Console.WriteLine()之后的行会导致此错误:

  System.DllNotFoundException:gtksharpglue-2 
at(wrapper managed-to-native)Gtk.Container:gtksharp_gtk_container_get_focus_child_offset( )
at Gtk.Container..cctor()[0x00000] in< filename unknown>:0

虽然这个特定的.dll文件系统中不存在,但是快速 locate gtksharpglue-2 显示了以下文件:

  /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgtksharpglue-2.so 
/ opt / local / lib / libgtksharpglue- 2.a
/opt/local/lib/libgtksharpglue-2.la
/opt/local/lib/libgtksharpglue-2.so

这些文件对我有帮助吗?从这里进行调试/修复的下一步是什么?我已经搜索了Google,但是我对这个主题太陌生,不能识别有用的信息,或者有用的信息根本不存在。有人能帮我吗?提前感谢!

解决方案如何运行GTK Sharp MONO应用程序(例如用Xamarin Studio进行编译)是执行以下操作:
$ b


  1. 将您的mono / gtk-sharp应用编译为Release

  2. >

      [sharp]!/ bin创建shell脚本文件(bash)像这样/ sh 

    export DYLD_FALLBACK_LIBRARY_PATH =/ Library / Frameworks / Mono.framework / Versions / Current / lib:$ DYLD_FALLBACK_LIBRARY_PATH:/ usr / lib
    exec /Library/Frameworks/Mono.framework / Versions / Current / bin / mono ./AsketicExcel.exe




_3 。然后你可以运行这个表单终端,或者你可以使用这个打包工具 http://sveinbjorn.org/platypus 和创建正常的OSX应用程序:)(包括在发布目录中的所有文件包)

然后为了在其他mac上运行这个应用程序,您将需要安装GTK# &安培;单声道运行时间 http://www.go-mono.com/mono-downloads/ download.html



最后它看起来像:


I'm trying to do my first steps in C# and wanted to build an empty GTK window as my first task. Via macports I installed the following packages:

  • mono@2.10.9
  • gtk-sharp@1.0.10
  • gtk-sharp2@2.12.10

I also use MonoDevelop from the Mono homepage.

I added gtk-sharp.dll (from /opt/local/lib/mono/gtk-sharp-2.0) to my references. My code looks like this:

using System;
using Gtk;

namespace lolbr_client
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine("Loading..");
            Window window = new Window("test");
        }
    }
}

When I compile and run that snippet, it seems to find and include the GTK-library, it prints "Loading.." to the console, but the line after Console.WriteLine() causes this error:

System.DllNotFoundException: gtksharpglue-2
  at (wrapper managed-to-native) Gtk.Container:gtksharp_gtk_container_get_focus_child_offset ()
  at Gtk.Container..cctor () [0x00000] in <filename unknown>:0

While that particular .dll doesn't exist on my filesystem, a quick locate gtksharpglue-2 revealed the following files:

/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/libgtksharpglue-2.so
/opt/local/lib/libgtksharpglue-2.a
/opt/local/lib/libgtksharpglue-2.la
/opt/local/lib/libgtksharpglue-2.so

Do those files help me? What are the next steps from here to debug/fix this? I already searched Google, but either I am too new to this subject to recognize useful information, or useful information just doesn't exist. Can someone help me? Thanks in advance!

解决方案

The solution how to run GTK Sharp MONO apps (compiled for example with Xamarin Studio) is to do following:

  1. Compile your mono/gtk-sharp app as Release

  2. Create shell script file (bash) like this (name it anyway you wish)

    [sharp]!/bin/sh
    
    export DYLD_FALLBACK_LIBRARY_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib:$DYLD_FALLBACK_LIBRARY_PATH:/usr/lib"    
    exec /Library/Frameworks/Mono.framework/Versions/Current/bin/mono ./AsketicExcel.exe
    

_3. Then you could run this form Terminal or you can use this packager tool http://sveinbjorn.org/platypus and create normal OSX App :) (include in the package all your files in Release dir)

Then in order to run this app on other mac you will need to install GTK# & Mono runtime http://www.go-mono.com/mono-downloads/download.html

In the end it would look like:

这篇关于单声道在OSX上:找不到gtksharpglue-2.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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