我目前使用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