1

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.

Cat Plus Plus
  • 125,936
  • 27
  • 200
  • 224
Jarrett
  • 1,767
  • 25
  • 47
  • 2
    According to the source (angelscript.h line 664), `GetFunctionIdByDecl` is deprecated, so you need to `#define AS_DEPRECATED` to use it. – chris Nov 13 '12 at 23:45
  • welp, that did it - I just looked over the api and found the correct way to do it now. Thanks @chris! If you put your solution as an Answer I'll mark it as solved (so you get the karma). Cheers – Jarrett Nov 13 '12 at 23:56

1 Answers1

1

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.

Jarrett
  • 1,767
  • 25
  • 47