使用angelscript编译错误

时间:2012-11-13 23:38:10

标签: c++ angelscript

我正在尝试使用gcc 4.7.1

使用angelscript 2.25.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.

基本上,它(我猜编译器)在GetFunctionIdByDecl中找不到asIScriptModule函数。我很确定它应该在那里。

此外,lin 242上的代码是:

int funcId = mod->GetFunctionIdByDecl(function);

其中function之前声明为char*mod的类型为asIScriptModule *mod

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

1 个答案:

答案 0 :(得分:1)

感谢@chris的回答。

  

根据源(angelscript.h第664行),GetFunctionIdByDecl   不推荐使用,因此您需要#define AS_DEPRECATED才能使用它。