Squirrel

The programming language
Welcome to Squirrel Sign in | Join | Help
in Search

[SqPlus] Problems with SqPlus::Push

Last post 10-06-2008, 5:42 AM by VRocker. 4 replies.
Sort Posts: Previous Next
  •  10-05-2008, 6:31 AM 2818

    [SqPlus] Problems with SqPlus::Push

    Hello,

    I seem to be having some problems with SqPlus when pushing a custom class to the script.
    I can define it fine and it works when i do 'local vec = Vector( 0.0, 0.0, 0.0 );'
    But when i come to doing Push( v, vec ); in C++ i get this error:

    error LNK2019: unresolved external symbol "void __cdecl SqPlus::Push(struct SQVM *,class Vector &)" (??$Push@VVector@@@SqPlus@@YAXPAUSQVM@@AAVVector@@@Z) referenced in function "public: static int __cdecl CSQPlayerFuncs::GetPos(struct SQVM *)" (?GetPos@CSQPlayerFuncs@@SAHPAUSQVM@@@Z) SQPlayerFuncs.obj


    I am using the latest SqPlus from the SVN repository and Squirrel 3.0 Alpha 1 and compiling using Visual Studio 2005

    Any help would be greatly appreciated
  •  10-06-2008, 12:05 AM 2819 in reply to 2818

    Re: [SqPlus] Problems with SqPlus::Push

    You have not generated bodies for the functions requested by the linker.
     In your source file you need

      DECLARE_INSTANCE_TYPE(Vector)
      // ... and so one for whatever classes you bind.

    This macro generates the functions the linker asks for.

    It's not enough with only SQClassDef<Vector>...

    Regards
    // Arst
  •  10-06-2008, 1:18 AM 2820 in reply to 2819

    Re: [SqPlus] Problems with SqPlus::Push

    I've already added that and still getting the same error. Anything else i may have missed?
  •  10-06-2008, 4:12 AM 2822 in reply to 2820

    Re: [SqPlus] Problems with SqPlus::Push

    You have to follow the code in sqplus.h a bit.

    DECLARE_INSTANCE_TYPE results in DECLARE_INSTANCE_TYPE_NAME_
    and this generates two Push functions, matching the ones your linker is asking for.

    To clarify a compiler/link problem involving macros, it is sometimes helpful to expand
    macros manually into ones source file, so one can see exactly where the problem is.

    There could be some issue with name-spaces also.

    There are useful examples in the testSqPlus2Unit folder.

    Regards
    // ATS.
  •  10-06-2008, 5:42 AM 2826 in reply to 2822

    Re: [SqPlus] Problems with SqPlus::Push

    I feel like such a fool... i had the DECLARE_INSTANCE_TYPE inside a cpp file instead of the main header file i was linking against >
    I realised when i was breaking it all down.

    Thanks for your help :)
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems