OSX 上的 Mono:找不到 gtksharpglie-2.dll

Mono on OSX: Couldn#39;t find gtksharpglue-2.dll(OSX 上的 Mono:找不到 gtksharpglie-2.dll)
本文介绍了OSX 上的 Mono:找不到 gtksharpglie-2.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 上的 Mono:找不到 gtksharpglie-2.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)