question about the C++ functions

23 megtekintés
Ugrás az első olvasatlan üzenetre

Diana Chen

olvasatlan,
2020. máj. 11. 11:29:142020. 05. 11.
– CLIP...@googlegroups.com
Hello,

I've used makefile to generate the libclips++.a and used codeblocks to link to it, along with the clips.h file.

I #include "clips.h" in my main.cpp file, and it seems the linking is working.

However, when I try to run any clips functions, it always returns an error.
Here are specific questions I have:

1.I tried typing in the basic functions of clips, such as run(), or load(), but it always suggests "EnvRun()" or "EnvLoad" or "EnvInitializeFacts()".
Is this normal?

2. When I try out Envrun() or EnvClear() I get the errors :

||=== Build: Debug in ctest (compiler: GNU GCC Compiler) ===|
/home/diandian/Diana/cpp/ctest/main.cpp||In function ‘int main()’:|
/home/diandian/Diana/cpp/ctest/main.cpp|9|error: too few arguments to function ‘void EnvClear(void*)’|
/home/diandian/Diana/cpp/cpplinker/obj/constrct.h|156|note: declared here|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

How should I go about fixing this?

3. What are the standard function names for CLIPS functions in C++? Are they simply run(), load().....?

Thanks!
Diana

CLIPS Support

olvasatlan,
2020. máj. 11. 18:30:042020. 05. 11.
– CLIPSESG
  1. If by 'it' you mean the text code editor in your Integrated Development Environment, then yes that's normal. The IDE dynamically analyzes your code as you type it and when it sees that you are entering a function name it will  suggest functions that have been defined in the source code. Since the functions 'run' and 'load' are not defined in the C source code for CLIPS, it suggests functions that are (such as EnvRun and EnvLoad).
  2. If you don't supply the arguments specified for a function, then you will get an error. Since the EnvClear function expects a single argument, the compiler will generate an error if you don't specify just one argument of the expected type.
  3. The list of functions and their expected arguments are documented in the Advanced Programming Guide: http://www.clipsrules.net/apg631.pdf
Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet