2012-11-13 72 views
1

我想使用天使脚本2.25.1使用gcc 4.7.1使用天使脚本编译错误

我编译的天使脚本没有问题。

当我尝试编译我的项目使用angelscript,但是,我得到这个错误:

[email protected]:~/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. 

因此,基本上,它(我猜编译器)不能在asIScriptModule找到GetFunctionIdByDecl功能。我很确定它应该在那里。

此外,在林242的代码是:

int funcId = mod->GetFunctionIdByDecl(function); 

其中function较早作为char*mod声明是asIScriptModule *mod类型。

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

+2

据有关人士(angelscript.h线664),'GetFunctionIdByDecl'已过时,所以你需要'#定义AS_DEPRECATED'使用它。 – chris

+0

ahhh..hmm。感谢克里斯......我会给出一个结果 – Jarrett

+0

韦尔普,这是做到了 - 我只是看了一遍API,找到了正确的方法来做到这一点。谢谢@chris!如果你把你的解答作为答案,我会把它标记为已解决(所以你得到了业力)。干杯 – Jarrett

回答

1

感谢@chris的答案。

According to the source (angelscript.h line 664), GetFunctionIdByDecl is deprecated, so you need to #define AS_DEPRECATED to use it.