1
votes

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:

  • [EXPRNPSR3] Missing function declaration for 'printout'.

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 ??

1
Readers won't be able to reconstruct your problem at home based on this description. You need to include the smallest set of code that people can copy/paste into their local computer and test against. Something like a "Hello World" program, but just the basics stuff for clip. Hard to believe open() is not found. Good luck.shellter
@shellter I've updated the question with code, would you please check it ?Mazen Ak
I don't have any experience with MacOS stuff, so I was only offering the obvious help to get others to help you.I would also look at any that printout is using. I just did some research and it seems there are special libs etc. Did you see this entry stackoverflow.com/a/44432497/620097 ? It looks promising to me. In general, getting software designed for one system architecture to run on a different sys arch can be anywhere from daunting to near impossible, so more research about cross-platform code will help you decide if this is worth the time. ,,,,shellter
I would recommend adding a tag for the compiler you are using. Good luck.shellter

1 Answers

1
votes

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.