c# – 在Debian上运行单错误CS8027:运行pkg-config时出错

我在debian上.
我做了sudo apt-get install mono-complete

我正在尝试编译这个程序

user@debian:~$cat a2.cs
using Gtk;
using System;

class Hello {

        static void Main()
        {
                Application.Init ();

                Window window = new Window ("helloworld");
                window.Show();

                Application.Run ();

        }
}

然后,当我尝试编译它时,我得到了这个错误

user@debian:~$mcs a2.cs -pkg:gtk-sharp-2.0
Package gtk-sharp-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk-sharp-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk-sharp-2.0' found
error CS8027: Error running pkg-config. Check the above output.
user@debian:~$

一个类似问题的答案就说试试dmcs

user@debian:~$dmcs a2.cs -pkg:gtk-sharp-2.0
Package gtk-sharp-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk-sharp-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk-sharp-2.0' found
error CS8027: Error running pkg-config. Check the above output.
user@debian:~$

但dmcs给出了同样的错误

我看到有人建议你做yum install gtk-sharp2,但无论我使用什么咒语说没有包可用所以我不确定那个包是什么

user@debian:~$sudo yum install gtk-sharp-2.0
Setting up Install Process
No package gtk-sharp-2.0 available.
Nothing to do
user@debian:~$

user@debian:~$sudo yum install gtk-sharp2-devel
Setting up Install Process
No package gtk-sharp2-devel available.
Nothing to do
user@debian:~$

我查找了我的错误https://stackoverflow.com/search?q=cs8027,他们都说这个变量PKG_CONFIG_PATH必须指向正确的路径.

目前虽然变量不存在,但我不知道指向它的路径.显然,这是一个包含gtk的.pc文件的路径.我不知道那是哪里.

user@debian:/usr$echo $PKG_CONFIG_PATH

user@debian:/usr$
最佳答案
你说你正在使用debian,但你运行yum?
似乎不是一个好主意.

试试跑步:

sudo apt-get update
sudo apt-get install gtk-sharp2

然后,别忘了做:

make clean

并从一开始就开始编译过程.

由barlop添加

我第一次尝试它时遇到了错误:0:System.Drawing.SizeF.Conversion,xpath:/ Type / Members / Member [@ MemberName =’op_Conversion’] / Docs和我中断了安装但是继续尝试安装然后说它打断了.

但再次执行该命令,apt-get似乎没有重新安装它,但立即说它是最新版本,我的程序编译.因此,尽管安装时出现问题,但必须已经安装或安装.

它使这个文件/usr/lib/pkgconfig/gtk-sharp-2.0.pc等等,

$dmcs a2.cs -pkg:gtk-sharp-2.0< - 然后工作

转载注明原文:c# – 在Debian上运行单错误CS8027:运行pkg-config时出错 - 代码日志