1

我正在尝试使用 angelscript 2.25.1 使用 gcc 4.7.1

我编译 angelscript 没有问题。

但是,当我尝试编译使用 angelscript 的项目时,出现此错误:

jarrett@jarrett-g74s:~/projects/myproject$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/common/as_wrapper/AngelScript.o -c -I"../lwis/src/engine" -I"../ice_engine/src/engine" src/common/as_wrapper/AngelScript.cpp
src/common/as_wrapper/AngelScript.cpp: In member function ‘void as_wrapper::AngelScript::loadScripts()’:
src/common/as_wrapper/AngelScript.cpp:85:33: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/common/as_wrapper/AngelScript.cpp:87:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/common/as_wrapper/AngelScript.cpp:88:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
src/common/as_wrapper/AngelScript.cpp: In member function ‘int as_wrapper::AngelScript::initContext(char*, char*)’:
src/common/as_wrapper/AngelScript.cpp:242:20: error: ‘class asIScriptModule’ has no member named ‘GetFunctionIdByDecl’
src/common/as_wrapper/AngelScript.cpp:258:22: error: invalid conversion from ‘int’ to ‘asIScriptFunction*’ [-fpermissive]
In file included from src/common/as_wrapper/AngelScript.h:11:0,
                                 from src/common/as_wrapper/AngelScript.cpp:8:
/usr/local/include/angelscript/angelscript.h:734:26: error:   initializing argument 1 of ‘virtual int asIScriptContext::Prepare(asIScriptFunction*)’ [-fpermissive]
scons: *** [build/common/as_wrapper/AngelScript.o] Error 1
scons: building terminated because of errors.

所以基本上,它(我猜是编译器)GetFunctionIdByDeclasIScriptModule. 我很确定它应该在那里。

此外,lin 242 上的代码是:

int funcId = mod->GetFunctionIdByDecl(function);

wherefunction之前声明为 achar*并且mod是 类型asIScriptModule *mod

我认为这可能是 gcc 4.7.1 的问题......但我不确定。

4

1 回答 1

1

感谢@chris 的回答。

根据来源(angelscript.h 第 664 行),GetFunctionIdByDecl 已被弃用,因此您需要 #define AS_DEPRECATED 才能使用它。

于 2012-11-14T00:30:43.907 回答