Squirrel

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

SqPlus linking errors (new with latest snapshot)

Last post 10-14-2007, 12:02 PM by ats. 6 replies.
Sort Posts: Previous Next
  •  09-27-2007, 3:11 PM 2156

    SqPlus linking errors (new with latest snapshot)

    I grabbed the latest snapshot of SqPlus to get ats' changes as well as the function overloading stuff, and now I am getting a ton of linker errors when I try and compile my project. Here is a snippet of the errors:

    1>Matrix3Proxy.obj : error LNK2005: "void __cdecl SqPlus::Push<class Ogre::Degree>(struct SQVM *,class Ogre::Degree *)" (??$Push@VDegree@Ogre@@@SqPlus@@YAXPAUSQVM@@PAVDegree@Ogre@@@Z) already defined in BindingManager.obj
    1>Matrix3Proxy.obj : error LNK2005: "void __cdecl SqPlus::Push<class Ogre::Degree>(struct SQVM *,class Ogre::Degree &)" (??$Push@VDegree@Ogre@@@SqPlus@@YAXPAUSQVM@@AAVDegree@Ogre@@@Z) already defined in BindingManager.obj
    1>Matrix3Proxy.obj : error LNK2005: "bool __cdecl SqPlus::Match<class Ogre::Degree>(struct SqPlus::TypeWrapper<class Ogre::Degree &>,struct SQVM *,int)" (??$Match@VDegree@Ogre@@@SqPlus@@YA_NU?$TypeWrapper@AAVDegree@Ogre@@@0@PAUSQVM@@H@Z) already defined in BindingManager.obj
    1>Matrix3Proxy.obj : error LNK2005: "bool __cdecl SqPlus::Match<class Ogre::Degree>(struct SqPlus::TypeWrapper<class Ogre::Degree *>,struct SQVM *,int)" (??$Match@VDegree@Ogre@@@SqPlus@@YA_NU?$TypeWrapper@PAVDegree@Ogre@@@0@PAUSQVM@@H@Z) already defined in BindingManager.obj

    But there are a ton of them. I trace the problem down to the fact that I have

    #ifndef __H_PROXIES_H__
    #define __H_PROXIES_H__

    DECLARE_INSTANCE_TYPE_NAME(Ogre::Degree, Degree)
    DECLARE_INSTANCE_TYPE_NAME(Ogre::Radian, Radian)
    DECLARE_INSTANCE_TYPE_NAME(Ogre::Vector3, Vector3)
    DECLARE_INSTANCE_TYPE_NAME(Ogre::Matrix3, Matrix3)

    #endif

    In a head that is included in several of the CPP files (thus re-defining the symbols). This worked with the latest stable release of SqPlus, so what changed? Am I missing something obvious? The biggest issue that I've found is inter-proxy dependency. If the DECLARE_INSTANCE_TYPE doesn't come before the SQClassDef of a class that requires one of the previous instance types for a method or variable (such as Matrix3 having functions that return Vector3's), the Matrix3 SQClassDef will fail to compile, complaining about Vector3 not having the proper Get and Match methods.
  •  09-28-2007, 3:36 AM 2158 in reply to 2156

    Re: SqPlus linking errors (new with latest snapshot)

    Hello,

    I downloaded and tested my project with snapshot, no problem (gcc). However, that is a different setting, different defines.


    Looking closer, I found some 'inline' tagging has been lost in the source that could cause your problem. That would explain two copies of a function being emitted to the linker.

    To re-insert thos inlines, do:
    1 - Move to where #define DECLARE_INSTANCE_TYPE_BASE
    2 - Make sure every function in the declare block is tagged with inline (also the template<> functions.
    3 - There are two #define DECLARE_INSTANCE_TYPE_BASE blocks. Do it in both of them.

    If this works, I'll commit the changes to Sourceforge SVN.

    Regards
    // ATS

  •  09-28-2007, 6:07 PM 2159 in reply to 2158

    Re: SqPlus linking errors (new with latest snapshot)

    That did it. I fixed all the DECLARE_INSTANCE_TYPE* macros and added inline to all of the template functions it was removed from. Fixed the linking error.
  •  10-13-2007, 8:00 AM 2188 in reply to 2159

    Re: SqPlus linking errors (new with latest snapshot)

    Has the fix for this been committed yet? If so, what's the revision number? I grabbed the latest revision but it still appears to be broke. I tried the steps above, but I had to add inlines to several more places than specified. I'm still getting one link error:

    error LNK2019: unresolved external symbol "void __cdecl SqPlus::Push<void>(struct SQVM *,void *)" (??$Push@X@SqPlus@@YAXPAUSQVM@@PAX@Z) referenced in function "public: class SquirrelObject __thiscall SquirrelObject::SetByValue<void *>(void *)" (??$SetByValue@PAX@SquirrelObject@@QAE?AV0@PAX@Z)

  •  10-13-2007, 9:43 AM 2189 in reply to 2188

    Re: SqPlus linking errors (new with latest snapshot)

    Yes, I uploaded corrections to this two weeks ago, into trunk/sqplus (rev 125). Is this what you're using ?

    Where else did you have to change?

    Looking at the source, I see only a Push handler for  const void* and not for void*. That would explain your link problem. Don't know if a Push<void*> would break anything.

    There was some rearranging of source code around this.

    Regards
    // ATS.
  •  10-13-2007, 7:52 PM 2191 in reply to 2189

    Re: SqPlus linking errors (new with latest snapshot)

    I guess I pulled the latest from your personal branch. I pulled rev 125 from trunk and it seems to be ok, except for the link error I mentioned. There is a Push handler for a SqAnythingPtr which is the same thing as a void*, right?

    Off topic, but are there any plans to bump up to Squirrel 2.1.2?
  •  10-14-2007, 12:02 PM 2195 in reply to 2191

    Re: SqPlus linking errors (new with latest snapshot)

    Yes, I think SqAnythingPtr does that, but I haven't used it.

    Not me bumping SqPlus...

    Regards
    // ATS
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems