简体   繁体   English

如何在C ++项目中使用CLIPS源代码?

[英]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 ++项目中。

the source files.jpg 源文件.jpg

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.

相关问题 如何在C ++中运行剪辑? - How can I run clips in C++? 如何将用C编写的源代码从另一个项目包含到我自己的Visual Studio C ++项目中 - How can I include source code written in C from another project into my own project in C++ in Visual Studio 如何在Haxe Project中使用简单的c ++代码? - How can I use simple c++ code in Haxe Project? 如何共享我的C / C ++项目并隐藏一些源代码? - How do I share my C/C++ project and hide some of the source code? 如何在Android中使用我的OpenCV C ++代码? - How can I use my OpenCV C++ code in Android ? 如何在 Xamarin.forms 项目中调试 .a libs(c++ 并且我有源代码)? - How can I debug .a libs(c++ and I have source code) in a Xamarin.forms project? 我如何创建一个使用开源C项目的C ++控制台应用程序 - How can I create a c++ console application which makes use of an open source c project 如何在名为 Flix for Fun Profit Report 的 C++ 程序中修复我的源代码? - How can I fix my source code in my C++ program called Flix for Fun Profit Report? 如何在我的项目中使用几个C ++文件而不将每个文件都编译为C ++? - How can I use a few C++ files in my project without compiling every file as C++? 如何在C#中使用没有源代码的C ++库? - how can I use a c++ library with no source code, in c#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM