Mazen Al Khatib
Mazen Al Khatib

Reputation: 308

Missing function declaration for 'printout' CLIPS

I have an executable file written in C++/MacOS takes a clips command and run it using clips.h functions. The executable works perfect on my Mac but once I try to run the same clips command I'm facing an error.

I've searched for any thing could help but I couldn't find a really helpful things.

The commands are simple and the functions should be builtin clips already.

here is the file I'm loading.

(defrule QPain
   =>
   (printout t "Are You In Pain? ") 
   (bind ?answer (read))
   (if (eq ?answer y)
      then
      (bind ?*symcount* (+ ?*symcount* 1))))

and here is my c++ code,

#ifdef __cplusplus
extern "C" {
#endif
#include "clips.h"
#ifdef __cplusplus
}
#endif

#include <string>
#include <iostream>

using namespace std;

int main() {
    Environment* env = NULL;
    env = CreateEnvironment();
    SetConserveMemory(env, true);
    ReleaseMem(env, 0);
    Load(env, "/path/to/clp/file/above");
    Reset(env);
    Run(env, -1);
return 0;
}

For the above code I'm facing theses two errors:

What I'm missing ? is there any libs I need to install on Linux for running such commands even I'm using clips.h functions ??

Upvotes: 1

Views: 595

Answers (1)

Mazen Al Khatib
Mazen Al Khatib

Reputation: 308

I'm posting this for anyone who could struggle the same in future or could provide any help.

I was compiling clips with gcc compiler with the following flags:

-O3 -g -pipe -pedantic -std=gnu99 -fno-strict-aliasing -DIO_FUNCTIONS=0 -c

after going deeply through the Advance programming guide and each flag functionality I found a flag called BASIC_IO used to turn on/off the input/output functions (printout, open , .. , etc), so according to the guide I've changed the flag DIO_FUNCTIONS = 1 and recompiled clips files so the problem was solved.

Note: the difference in flags names could be related to version of clips and compiler version.

thanks for every one who helped with this issue.

Upvotes: 1

Related Questions