SwiPICs.dll PlEngine.Initialize FileNotFoundException

我只是一个虾纸丫 提交于 2019-12-02 12:03:41

问题


For educational purposes, one of our college subjects requires a project that integrates any instance of Prolog with any other GUI supportive language. I went with C# as I have the most experience with it. I'm trying to learn by example of my fellow college colleagues from higher years. They gave me their repos to download their code and to see how it all comes together. And this is where the problems started.

No matter what I do, what tutorial I follow, what tips from other sources I apply, the error will not change: FileNotFoundException was unhandled: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in SwiPlCs.dll.

I've tried using SWI 32 bit/64 bit, VS 2015/2017 with 32/64 bit builds, redownloading the DLL as a nuget package. None of them seem to work.

        InitializeComponent();
        igra.popuniSlagalicu += igra_popuniSlagalicu;
        igra.vratiOdgovor += igra_vratiOdgovor;
        String[] param = { "-q" };
        PlEngine.Initialize(param);
        PlQuery.PlCall("use_module(sudoku)");

This is the first time I felt helpless and desperate while trying to debug code. Literally stuck on a single line for 5 days without any progress whatsoever.


回答1:


The error is not very clear, but is caused by the fact that the program needs to know where to find the DLLs that run SWI-Prolog are located. There are a few ways to do this but the simplest is to add the directory (e.g. C:\Program Files\swipl\bin) containing the SWI-Prolog executable (swipl-win.exe) to the Windows system PATH variable.

After changing the system PATH variable you will need to restart Visual Studio if necessary.



来源:https://stackoverflow.com/questions/53877772/swipics-dll-plengine-initialize-filenotfoundexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!