Advertisement

AngelScript compile errors on GCC 11.1.0

Started by June 05, 2021 08:53 AM
4 comments, last by WitchLord 3 years, 4 months ago

After updating GCC to version 11.1.0 (from previously using GCC 9), angelscript fails to compile on the latest WIP because of as_symboltable.h:89

Is there any solution to this? Thanks in advance! Been using AS for the past few weeks and it's amazing

In file included from project/source/src/angelscript/source/as_module.h:43,
                 from project/source/src/angelscript/source/as_module.cpp:40:
project/source/src/angelscript/source/as_symboltable.h:89:56: error: invalid declarator before ‘)’ token
   89 |         asCSymbolTableIterator<T, T2>(asCSymbolTable<T>) *table;
      |                                                        ^
In file included from project/source/src/angelscript/source/as_property.h:47,
                 from project/source/src/angelscript/source/as_objecttype.h:44,
                 from project/source/src/angelscript/source/as_scriptengine.h:48,
                 from project/source/src/angelscript/source/as_bytecode.cpp:48:
project/source/src/angelscript/source/as_symboltable.h:89:56: error: invalid declarator before ‘)’ token
   89 |         asCSymbolTableIterator<T, T2>(asCSymbolTable<T>) *table;
      |                                                        ^
In file included from project/source/src/angelscript/source/as_property.h:47,
                 from project/source/src/angelscript/source/as_objecttype.h:44,
                 from project/source/src/angelscript/source/as_scriptengine.h:48,
                 from project/source/src/angelscript/source/as_callfunc.cpp:42:
project/source/src/angelscript/source/as_symboltable.h:89:56: error: invalid declarator before ‘)’ token
   89 |         asCSymbolTableIterator<T, T2>(asCSymbolTable<T>) *table;
      |                                                        ^
project/source/src/angelscript/source/as_symboltable.h:487:1: error: no declaration matches ‘asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T>*)’
  487 | asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T> *table) : m_table(table), m_idx(0)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from project/source/src/angelscript/source/as_property.h:47,
                 from project/source/src/angelscript/source/as_objecttype.h:44,
                 from project/source/src/angelscript/source/as_scriptengine.h:48,
                 from project/source/src/angelscript/source/as_gc.cpp:42:
project/source/src/angelscript/source/as_symboltable.h:89:56: error: invalid declarator before ‘)’ token
   89 |         asCSymbolTableIterator<T, T2>(asCSymbolTable<T>) *table;
      |                                                        ^
project/source/src/angelscript/source/as_symboltable.h:487:1: note: no functions named ‘asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T>*)’
project/source/src/angelscript/source/as_symboltable.h:487:1: error: no declaration matches ‘asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T>*)’
  487 | asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T> *table) : m_table(table), m_idx(0)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
project/source/src/angelscript/source/as_symboltable.h:77:7: note: ‘class asCSymbolTableIterator<T, T2>’ defined here
   77 | class asCSymbolTableIterator
      |       ^~~~~~~~~~~~~~~~~~~~~~
project/source/src/angelscript/source/as_symboltable.h:487:1: note: no functions named ‘asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T>*)’
project/source/src/angelscript/source/as_symboltable.h:77:7: note: ‘class asCSymbolTableIterator<T, T2>’ defined here
   77 | class asCSymbolTableIterator
      |       ^~~~~~~~~~~~~~~~~~~~~~
project/source/src/angelscript/source/as_symboltable.h:487:1: error: no declaration matches ‘asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T>*)’
  487 | asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T> *table) : m_table(table), m_idx(0)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
project/source/src/angelscript/source/as_symboltable.h:487:1: note: no functions named ‘asCSymbolTableIterator<T, T2>::asCSymbolTableIterator(asCSymbolTable<T>*)’
project/source/src/angelscript/source/as_symboltable.h:77:7: note: ‘class asCSymbolTableIterator<T, T2>’ defined here
   77 | class asCSymbolTableIterator

Editing a large post seems to be a bit buggy so I'll just post a follow-up here

After a bit of research, I find out that as of GCC 11 you will get a compiler error if you specify the template parameter type on a class constructor with already defined templates. (which wasn't even required regardless of GCC version) See https://codereview.qt-project.org/c/qt/qtbase/+/339417

Removing both the template parameters made the code compilable

asCSymbolTableIterator(asCSymbolTable<T> *table);
Advertisement

Thanks for letting me know. I've applied this fix in rev 2735.

Regards,
Andreas

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

As someone who tried many solutions (python, lua, squirrel, angelscript), here my comments.

For me it was not clear how Angelscript had to wrap my objects. I recall having some kind of intrusive reference count, but could not get it. What got most in the way for me was, actually, that Angelscript is statically typed.

I really think that for my scripting purposes (at least) it is better to have a dynamic language. For a static one I already have C++ after all. Angelscript advantage seemed to be that it had been tried in lots of platforms and is similar to C++ (from a C++ POV).

I also tried lua + bindings, it is nice, but lua looks so irregular to me compared to other programming languages (indexing at 1, no classes at all by default, etc.) It is brief though and resonably easy to bind. I did not try it in mobile yet so I cannot speak for this part.

As for python, I just cannot use it for all platforms easily (mobile for example).

Squirrel: tried and it looked nice, but at the end I left it bc doing bindings through its c++ wrapper through sqrat.

At the end I went for Chaiscript and did not move from there since then: dynamically typed, similar to javascript and good integration with C++, very good indeed and its strongest point for my needs. Slow to compile though.

@jonus01 Off topic, but thanks for sharing your thoughts, I'm pleased to know you tried out my library before deciding not to use it. If you wish to continue to discuss pros and cons of angelscript compared to other solutions please start a new topic.

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

This topic is closed to new replies.

Advertisement