compiling AngelScript - error!

Started by
5 comments, last by MatthewMalice 10 years ago

Hello,

First - Hi! It's my first post in here! :)

I am trying to compile a project named opendungeons. They've got some dependencies, and they use cmake. I executed cmake, and now I'm trying to use make, but I am encountering an error:

http://pastebin.com/j5sbQVmt

Any ideas what may be causing this problem?

Thanks in advance.

Advertisement

You didn't post the error you're encountering.

I'm just seeing the commandline for compiling the the file po_parser.cpp from tinygettext. The commandline itself seems to be OK.

What is the error you're getting?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Oh my. Sorry, I've switched the links. Here's the proper one:

http://pastebin.com/6xphrq54

Ah, it looks like the OpenDungeons managers haven't upgraded the AngelScript version they are using for a while.

This compilation error is specific to the g++ 4.7+ compiler and version. In a more recent version of AngelScript I've solved it by implementing a wrapper for the std::string::operator==. Like this:

// String equality comparison.
// Returns true iff lhs is equal to rhs.
//
// For some reason gcc 4.7 has difficulties resolving the
// asFUNCTIONPR(operator==, (const string &, const string &)
// makro, so this wrapper was introduced as work around.
static bool StringEquals(const std::string& lhs, const std::string& rhs)
{
    return lhs == rhs;
}
 
void RegisterStdString_Native(asIScriptEngine *engine)
{
   ...
 
   // Need to use a wrapper for operator== otherwise gcc 4.7 fails to compile
   r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in) const", asFUNCTIONPR(StringEquals, (const string &, const string &), bool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );
 
   ...
}

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

That's actually strange - I'm using g++ 4.8.2 .

Yes, 4.8.2 has the same STL implementation as 4.7 so you'll definitely need the update in scriptstdstring.cpp that I mentioned above.

Note, this is not a bug in g++. It's just that with 4.7 they changed their STL implementation, previously the operator== was a global function as it is on other compilers, but with 4.7 they changed it to be an member operator, which is why the asFUNCTIONPR macro stopped working.

Talk to the OpenDungeons managers to update the scriptstdstring.cpp with the above fix (or even update the entire angelscript library), and you should be good to go.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thank you very much for your help! You've been most helpful.

This topic is closed to new replies.

Advertisement