How to use Prolog in C #? Swi-prolog

Source: Internet
Author: User

Last month saw Prolog this language, its special grammar attracted me, but after a period of study, I found that it is not as magical as the legend on the Internet, but I am still interested in it, there are predecessors said Prolog itself is not strong, But used as a supplementary language to solve some special problems or very effective, it happens that I am a C #, I looked up how to combine Prolog and C #, but I Baidu came out of the information can only be used to describe the sparse. No way can only Google, the old D's Hosts file is very useful.

Fortunately, as a high-level code farm I will be a little Chinese, thinking of a half-day finally how to use Prolog these words out, and then the magic of Google helped me to give a few options

I can't help but sigh, technology changes the world, code changes the world.

Although my English writing ability is not strong, but reading ability is still possible, found a few posts finally found several solutions, such as P#,swi-prolog and so on.

After a few comparisons, I finally chose swi,http://www.swi-prolog.org/This is its official website, which is a relatively comprehensive help document and so on, and then again a toss to determine the need for the two files, a Swi-prolog installation program, There is also a DLL file, these two files are divided into 32-bit and 64-bit two, first install SWI, and then create a console program, reference SwiPlCs.dll.

Well, the preparation is done, and then the code, I followed the official example to write a code, and then excited to press CTRL+F5 but the result is not the same as I imagined, like this

This is Shenmegui? How is it different from the deal? I hurried to Google search information, sure enough, the foreign great God also has encountered this problem, the official website also has about this error explanation, the wit I rely on solid English Foundation plus browser Web translation function finally understand more than half, probably meaning is not configured environment variable, probably with Java is a reason, So I added swi_home_dir this environment variable, and then continue to run, of course, there is no egg use, is still the above error, then I tried dozens of methods, replaced by 32-bit DLL, installed a win7 virtual machine plus vs2010, installed XP virtual machine plus vs2010, Various methods have tried, the result is still so, toss a few days I almost give up.

Happened to be bored this evening, and Google a bit about this problem, suddenly see this document on the official website http://www.swi-prolog.org/pack/file_details/swicli/doc/introduction-SbsSW.htm

Inside said to add the bin directory to the PATH environment variable, I hold a try to put this sentence in the code

Environment.setenvironmentvariable ("PATH"@ "C:\Program Files\swipl\bin ");

Then Ctrl+f5, then this article is over, mom really can, toss for so long is because of this reason

How to use Prolog in C #? Swi-prolog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.