Newbie help with compiling

Started by
3 comments, last by WitchLord 15 years, 2 months ago
Hi I'm trying to embed Angelscript into a X10 house automation program - but as soon as I add the angelscript.h header file - I get this error:

In file included from x10.c:40:
/usr/local/include/angelscript.h:64: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptEngine’
/usr/local/include/angelscript.h:65: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptModule’
/usr/local/include/angelscript.h:66: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptContext’
/usr/local/include/angelscript.h:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptGeneric’
/usr/local/include/angelscript.h:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptStruct’
/usr/local/include/angelscript.h:69: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptArray’
/usr/local/include/angelscript.h:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIObjectType’
/usr/local/include/angelscript.h:71: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptFunction’
/usr/local/include/angelscript.h:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIBinaryStream’
/usr/local/include/angelscript.h:324: error: expected ‘)’ before ‘*’ token
/usr/local/include/angelscript.h:333: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asCUnknownClass’
/usr/local/include/angelscript.h:334: error: expected ‘)’ before ‘:’ token
/usr/local/include/angelscript.h:341: error: expected specifier-qualifier-list before ‘asMETHOD_t’
/usr/local/include/angelscript.h:369: error: expected specifier-qualifier-list before ‘asEMsgType’
/usr/local/include/angelscript.h:395: error: expected identifier or ‘(’ before string constant
/usr/local/include/angelscript.h:416: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptEngine’
/usr/local/include/angelscript.h:534: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptModule’
/usr/local/include/angelscript.h:586: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptContext’
/usr/local/include/angelscript.h:667: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptGeneric’
/usr/local/include/angelscript.h:707: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptStruct’
/usr/local/include/angelscript.h:731: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptArray’
/usr/local/include/angelscript.h:754: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIObjectType’
/usr/local/include/angelscript.h:780: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIScriptFunction’
/usr/local/include/angelscript.h:802: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asIBinaryStream’
/usr/local/include/angelscript.h:835: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
/usr/local/include/angelscript.h:849: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
/usr/local/include/angelscript.h:867: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asCSimpleDummy’
/usr/local/include/angelscript.h:868: error: expected ‘)’ before ‘:’ token
/usr/local/include/angelscript.h:869: error: ‘asSIMPLEMETHOD_t’ undeclared here (not in a function)
/usr/local/include/angelscript.h:872: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
/usr/local/include/angelscript.h:886: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
make: *** [x10.o] Error 1
I can compile Angelscript by itself using the gnuc makefile. Using version 2.14.1. Any help greatly appreciated. Thanks
Advertisement
AngelScript.h is a C++ header. x10.c is a C file. Trying to compile C++ code in C isn't kosher. You can try the angelscript_c.h header in add_on/clib.
Quote:Original post by SiCrane
AngelScript.h is a C++ header. x10.c is a C file. Trying to compile C++ code in C isn't kosher. You can try the angelscript_c.h header in add_on/clib.


Thanks - now I only get these errors:

In file included from x10.c:36:/usr/local/include/angelscript_c.h:365: error: expected declaration specifiers or ‘...’ before ‘bool’/usr/local/include/angelscript_c.h:425: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asEngine_IsHandleCompatibleWithObject’/usr/local/include/angelscript_c.h:426: error: expected declaration specifiers or ‘...’ before ‘bool’/usr/local/include/angelscript_c.h:428: error: expected declaration specifiers or ‘...’ before ‘bool’/usr/local/include/angelscript_c.h:535: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asObjectType_IsInterface’/usr/local/include/angelscript_c.h:547: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asScriptFunction_IsClassMethod’/usr/local/include/angelscript_c.h:548: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘asScriptFunction_IsInterfaceMethod’make: *** [x10.o] Error 1


They all seem to be related to 'bool' declarations in the file.

bool isn't a native type in C. If you're using a compiler that supports the 1999 version of the C standard, then you can #include <stdbool.h> before #including "angelscript_c.h" and that will probably get things to work. Since those look like gcc error messages, if you're using a relatively recent version of gcc, then you probably have C99 support, though you may need to add -std=c99 to to the compiler options.

However, that's just a workaround. This looks like it's an issue in the implementation of the C add-on to me.
I'll update the C interface to avoid use of bool as a type.

Thanks for letting me know.

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