1
我有將Prolog連接到C#的問題。將Microsoft .NET(C#/ F#)與SWI-Prolog接口
Visual Studio中給出了這樣的以下錯誤:
「類型 'System.IO.FileNotFoundException' 未處理的異常發生在SwiPlCs.dll」
,我真的不知道如何處理這個。
我覺得從我的代碼給了路徑傳來:
using System;
using SbsSW.SwiPlCs;
namespace ptest
{
class Program
{
static void Main(string[] args)
{
//Environment.SetEnvironmentVariable(@"C:\Program Files\swipl", @"C:\Program Files\swipl\boot64.prc"); // or boot64.prc
var curPath = Environment.GetEnvironmentVariable("C:\\Program Files\\swipl\\bin");
Environment.SetEnvironmentVariable(@"C:\Program Files\swipl\bin", @"C:\Program Files\swipl\boot;C:\Program Files\swipl;" + curPath);
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 (var 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 children from uwe:");
q.Variables["P"].Unify("uwe");
foreach (PlQueryVariables v in q.SolutionVariables)
Console.WriteLine(v["C"].ToString());
}
PlEngine.PlCleanup();
Console.WriteLine("finshed!");
}
}
}
}
請幫助我。非常感謝你。
感興趣的:[Swi-cs-pl-CSharp類庫連接.NET語言與SWI-Prolog](http://www.lesta.de/prolog/swiplcs/Generated/ Index.aspx) –
歡迎來到SO。當你問一個問題時,有助於提供更多的信息而不是更少的信息。 –
注意:2014.04.29 13:00發佈的[SwiPlCs_1.1.60605.0.zip](http://www.lesta.de/prolog/swiplcs/download/index.htm)的最新版本是beta版本。 –