2012-11-13 71 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.