first,i changed the source code's extension to .cpp. And add them all into my C++ project.
second.im my main func,i code this:
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. just like this: the result .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.
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()
.
Following feedback:
extern "C" int main () { return ClipsEmbed::main(); }
Might help?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.