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.
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 systemPATH
variable.After changing the system PATH variable you will need to restart Visual Studio if necessary.