Trouble compiling test project

Started by
7 comments, last by WitchLord 1 year, 6 months ago

I'm having trouble compiling. I tried copying the “Your first script” example as a test to figure out the process of integrating angelscript into a project and got the errors in the picture attached.
I have both scriptstdstring.cpp and scriptstdstring_util.cpp included in the project sources in CMake.

Advertisement

It's all linker errors so clearly your cmake project is not including all the necessary parts.

I suggest taking a look at the cmake project for the game sample:

http://svn.code.sf.net/p/angelscript/code/trunk/sdk/samples/game/projects/cmake/CMakeLists.txt

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

Here's my cmake script and the new output after verifying everything was accounted for. Somehow there's even more problems than before.

unresolved external symbol asCreateScriptEngine, asGetLibraryOptions, asGetActiveContext, asAcquireExclusiveLock, etc

These errors are because you're not linking with the angelscript library. I see your cmake script contains the instructions for the linkage, so I can only believe you have either not compiled the library, or it is not located in the directory you've specified in the cmake script.

unresolved external symbol CScriptArray::Create, CScriptArray::GetSize, CScriptArray::Resize, etc

These errors are because you're not building and linking with the scriptarray add-on. Include it in the cmake script the same way you've done with the scriptstdstring add-on.

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

I read over the linking instructions again and found that I was missing the preprocessor directive “#define ANGELSCRIPT_DLL_LIBRARY_IMPORT” for dll linking, however since I'm building for 64 bit it comes with the stipulation that MSVC can't perform any inline assembly. The angelscript instructions give “ml64.exe /c /nologo /Fo$(OutDir)\as_callfunc_x64_msvc_asm.obj /W3 /Zi /Ta $(InputDir)\$(InputFileName)” as the command to use to generate a separate assembly file. Due to this new step I have no way to test if the define is actually the fix yet. I'd like to have CMake include the command in the project it generates, so once I get that assembly step integrated I'll report back.

I don't know cmake very well, but the angelscript cmake script already contains the instructions for building the library for 64bit on Windows with MSVC.

if(MSVC AND CMAKE_CL_64)
    enable_language(ASM_MASM)
    if(CMAKE_ASM_MASM_COMPILER_WORKS)
        set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_x64_msvc_asm.asm)
    else()
        message(FATAL ERROR "MSVC x86_64 target requires a working assembler")
    endif()
endif()

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

Adding the preproc define did nothing either. I'm still getting the 13 undefined symbol errors during linking.
I've got the feeling that Angelscript is garbage that I shouldn't be using.

That's not a nice thing to say. It saddens me that you feel that way about a project that I've spent almost 20 years working on and that satisfies so many other developers. But you're free to do as you wish, move on to something else. Best of luck to you.

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

This topic is closed to new replies.

Advertisement