Search code examples
c++angelscript

using angelscript compile error


I'm trying to use angelscript 2.25.1 using gcc 4.7.1

I compiled angelscript without issues.

When I try to compile my project that uses angelscript, however, I'm getting this error:

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.

So basically, it (I guess the compiler) can't find GetFunctionIdByDecl function in asIScriptModule. I'm pretty sure it should be there though.

Also, the code on lin 242 is:

int funcId = mod->GetFunctionIdByDecl(function);

where function is declared earlier as a char* and mod is of type asIScriptModule *mod.

I thought this might be an issue with gcc 4.7.1....but I'm not sure.


Solution

  • Thanks to @chris for the answer.

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