gpt4 book ai didi

c# - 使用 C# 的接口(interface)序言

转载 作者:行者123 更新时间:2023-11-30 12:12:28 24 4
gpt4 key购买 nike

我尝试将 C# 与 prolog 连接起来我用过这个链接: enter link description here

我添加了 SwiPlCs.dll 作为对我项目的引用,然后使用文档中的第一个代码

using System;
using SbsSW.SwiPlCs;


namespace HelloWorldDemo

{

class Program
{
static void Main(string[] args)
{
//Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"the_PATH_to_boot32.prc");
if (!PlEngine.IsInitialized)
{
String[] param = { "-q" }; // suppressing informational and banner messages
PlEngine.Initialize(param);
PlQuery.PlCall("assert(father(martin, inka))");
PlQuery.PlCall("assert(father(uwe, gloria))");
PlQuery.PlCall("assert(father(uwe, melanie))");
PlQuery.PlCall("assert(father(uwe, ayala))");
using (PlQuery q = new PlQuery("father(P, C), atomic_list_concat([P,' is_father_of ',C], L)"))
{
foreach (PlQueryVariables v in q.SolutionVariables)
Console.WriteLine(v["L"].ToString());

Console.WriteLine("all child's from uwe:");
q.Variables["P"].Unify("uwe");
foreach (PlQueryVariables v in q.SolutionVariables)
Console.WriteLine(v["C"].ToString());
}
PlEngine.PlCleanup();
Console.WriteLine("finshed!");
}
}
}

}

但总是有异常(exception)..据说:

The specified module could not be found. (Exception from HRESULT: 0x8007007E

在 SWI-prolog 中他们提到了这个错误:

If libswipl.dll or one of its dependencies could not found you will recive an error like System.IO.FileNotFoundException: Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E)

我已经将 libswipl.dll 从程序 bin 复制到我项目中的 bin/debug 文件夹,但它仍然是同样的问题。

我必须做什么??谢谢

最佳答案

你声明了 SWI_HOME_DIR 了吗?应该指向 c`\Program Files\pl

C# 接口(interface)不适用于 Windows 7 64 位、Visual Studio 2010 专业版。似乎是一个错误,Uwe Lesta 应该尽快修复这个错误。

关于c# - 使用 C# 的接口(interface)序言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13556887/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com