[英]how can i use CLIPS source code in my C++ project?
first,i changed the source code's extension to .cpp. 首先,我将源代码的扩展名更改为.cpp。 And add them all into my C++ project. 并将它们全部添加到我的C ++项目中。
second.im my main func,i code this: second.im是我的主要功能,我将其编码为:
namespace ClipsEmbed{
int main(){
Environment *theEnv;
theEnv = CreateEnvironment();
cout << Load(theEnv, "auto.clp");
Reset(theEnv);
Run(theEnv,-1L);
return 0;
}
}
after shooting some link and compile erro,it runs ok,but it just a CLIPS IDE,not my program. 拍摄一些链接并编译erro后,它可以正常运行,但它只是CLIPS IDE,而不是我的程序。 just like this: the result .jpg 就是这样: 结果.jpg
i guess there is another main function,but i did not know where,so please help.how can i use the source code not the DLL in c++ project. 我想还有另一个主要功能,但是我不知道在哪里,所以请帮助。我如何在C ++项目中使用源代码而不是DLL。
Your explanation is very confused and omitting details, but I think what you need is (at the simplest level): 您的解释非常混乱并且省略了细节,但是我认为您需要的是(最简单的水平):
namespace ClipsEmbed{
int main(){
Environment *theEnv;
theEnv = CreateEnvironment();
cout << Load(theEnv, "auto.clp");
Reset(theEnv);
Run(theEnv,-1L);
return 0;
}
}
int main () { return ClipsEmbed::main(); }
The main()
is inside the ClipsEmbed
namespace, so to satisfy the linker you need a plain main()
in the global namespace, so the simplest solution is as illustrated, calling the namespace's main()
from the global main()
. 在main()
是里面ClipsEmbed
命名空间,所以要满足你需要一个普通的链接器main()
在全局命名空间,所以最简单的解决方法是如图所示,调用命名空间的main()
从全球main()
Following feedback: 以下反馈:
extern "C" int main () { return ClipsEmbed::main(); }
Might help? 可能有帮助?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.