Search code examples
visual-studio-2008swi-prologxpce

XPCE Prolog command causing error in VS2008 C++


Upon loading into a C++ program a Prolog program that contains the command 'send' (xpce graphics), I get error messages of type:

Syntax Error: Operator Expected.

Here is an example command that causes the errors:

send( Dialog, append, button(continue, message(@prolog, clear_my_blackboard)) ),

I used to get the same errors when I used the plld.exe utility for interfacing my C++ and Prolog programs. At the time, I thought the problem was that plld was for some reason incompatible with xpce graphics.

But now that I consult (load) my Prolog source files into my C++ files using:

PlCall( "consult(myPrologFile.pl)" );

I still get these error messages. I could comment out the lines that contain xpce-specific commands, but I'd rather know what the problem is and how I can circumnavigate it. So, I would appreciate any help.

Cheers,


Solution

  • @ is apparently unknown!

    It is loaded by the 'rc' file in the SWI home dir and realizes the XPCE binding. I should load this by hand, using:

    consult( swi( 'plwin.rc' ) )
    

    All my pl and xpce source files were compiled successfully.

    I am interfacing C++ and Prolog to connect a cognitive architecture written in Prolog to a robotic simulator written in C++. I am using SWI version 5.8.0 so I had to use the following line in my C++ program to achieve that:

    PlCall( "consult( swi( 'plwin.rc' ) )" );
    

    This command resulted in:

    swi(plwin.rc) compiled into link_xpce
    

    Thanks to Jan Wielemaker.