我正在尝试使用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的问题....但我不确定。
答案 0 :(得分:1)
感谢@chris的回答。
根据源(angelscript.h第664行),GetFunctionIdByDecl 不推荐使用,因此您需要#define AS_DEPRECATED才能使用它。