我目前使用ChaiScript 6.0.0版和Visual Studio 2017错误:“找不到对象:使用”
在我的C++,我检索从脚本文件的功能on_init()
参考,并执行它。 ChaiScript对象是使用默认/空构造函数构造的。功能如下:
def on_init() {
use("scripts/test.chai");
}
的内容 “脚本/ test.chai” 看起来是这样的:
class A {
def A() {
print("Created an instance of A!");
}
}
我的文件结构如下:
bin
\
| my_executable.exe
| scripts
\
| main_menu.chai
| test.chai
当执行上面显示的功能on_init()
,控制台打印以下消息:
Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use" Error: "Can not find object: use"
构建ChaiScript对象时提供“usepaths”会导致相同的情况。
我试过use("test.chai")
以及use("scripts/test.chai")
,并且两者都产生相同的消息。
我没有提供任何构造ChaiScript对象的chaiscript::Options
枚举,所以它应该使用默认值(其中包含External_Scripts
以及Load_Modules
)。
我正在编译禁用线程安全的ChaiScript。
我没有任何问题在这个脚本的正文中运行其他任何内置函数,包括其他函数,我正以同样的方式检索(到C++)。
如果有任何需要的信息,请告诉我。
我是否正确使用“使用”功能?
它表现得像可用性完全从可执行文件中丢失。那或者,'test.chai'是一些正在引发递归的事情。两个都很奇怪但我需要一个更完整的例子来诊断。 'use'用于* all *单元测试,所以它已知可以工作。 – lefticus