Heyo!
I'm starting to develop a game using C w Raylib and AngelScript, installed AngelScript from AUR, following tutorials, I try to compile my prototype, and Error, in include … ‘class’ …, cool, it's for c++, searched a lil, I found this for C: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_addon_clib.html
I tried to compile it using the makefile in clib/projects/gnuc, but it fails with the following output:
g++ -Wall -I/usr/local/include -I../.. -L/usr/local/lib -c -fPIC ../../as_c.cpp -o as_c.o
../../as_c.cpp:53:7: error: conflicting return type specified for ‘virtual void asCBinaryStreamC::Write(const void*, asUINT)’
53 | void Write(const void *ptr, asUINT size) { write(ptr, size, param); }
| ^~~~~
In file included from ../../as_c.cpp:39:
/usr/local/include/angelscript.h:1168:14: note: overridden function is ‘virtual int asIBinaryStream::Write(const void*, asUINT)’
1168 | virtual int Write(const void *ptr, asUINT size) = 0;
| ^~~~~
../../as_c.cpp:54:7: error: conflicting return type specified for ‘virtual void asCBinaryStreamC::Read(void*, asUINT)’
54 | void Read(void *ptr, asUINT size) { read(ptr, size, param); }
| ^~~~
In file included from ../../as_c.cpp:39:
/usr/local/include/angelscript.h:1167:14: note: overridden function is ‘virtual int asIBinaryStream::Read(void*, asUINT)’
1167 | virtual int Read(void *ptr, asUINT size) = 0;
| ^~~~
../../as_c.cpp: In function ‘int asEngine_RegisterStringFactory(asIScriptEngine*, const char*, asFUNCTION_t, asDWORD, void*)’:
../../as_c.cpp:111:285: error: no matching function for call to ‘asIScriptEngine::RegisterStringFactory(const char*&, asSFuncPtr, asDWORD&, void*&)’
111 | e->RegisterStringFactory(datatype, asFUNCTION(factoryFunc), callConv, auxiliary); }
| ^
In file included from ../../as_c.cpp:39:
/usr/local/include/angelscript.h:694:14: note: candidate: ‘virtual int asIScriptEngine::RegisterStringFactory(const char*, asIStringFactory*)’
694 | virtual int RegisterStringFactory(const char *datatype, asIStringFactory *factory) = 0;
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/angelscript.h:694:14: note: candidate expects 2 arguments, 4 provided
make: *** [makefile:10: all] Error 1
I'm not gonna lie, I know that it says:
To compile the AngelScript C library, you need to compile the library source files in sdk/angelscript/source together with the source files in sdk/add-on/clib, and link them as a shared dynamic library. In the application that will use the AngelScript C library, you'll include the angelscript_c.h header file, instead of the ordinary angelscript.h header file. After that you can use the library much the same way that it's used in C++.
But I'm not an expert, and tried as it is anyways, I would like someone to point me in the right direction, thanks for your time and have a nice day!