SqPlus::Match' : none of the 43 overloads...

Started by
4 comments, last by Marius 17 years, 10 months ago
I think I ran in a problem. I have couple of funtions taking const pointers to parameters as: .. DECLARE_INSTANCE_TYPE(Class1); DECLARE_INSTANCE_TYPE(Class2); .. class C { ... void F(const Class1*, const Class2*); }; SQClassDef<C>(true,"C").func(&C::F,"F"); compiles with: error C2665: 'SqPlus::Match' : none of the 43 overloads could convert all the argument types f:\getae\squirrel2_1_0_sqplus_15\sqplus\sqplus.h(632): could be 'bool SqPlus::Match(SqPlus::TypeWrapper<T>,HSQUIRRELVM,int)' with [ T=bool ].... //all types. if .. void F(Class1*, Class2*); .. compiles fine.
MCO
Advertisement
Before including sqplus.h:

#define SQPLUS_CONST_OPT
Thank you.

This seems to resolve half the problem. Now I have
this scenario
One param is const the other not.

And...
where 'dofile("filename.nut");' assumes the defaut directory?
If all scripts are in directory 'scripts/<>'
and the exe that loads the scripts are is un dir up
dofile("just file") does not finds the include file.
Therefore all dofile have to be nodified as:
dofile("scripts/<>") !!!. Is there a way to specify the
include paths for the engine.


[source lang=cpp]class ClassClass{public:    ClassClass(){printf ("ClassClass::ClassClass \r\n");}    ~ClassClass(){printf ("ClassClass::~ClassClass \r\n");}    virtual void M1(){ printf ("ClassClass::M2 \r\n");}    void   Set( const Cparam* param){};    void   Get( Cparam* retval){};};


Here are the compiler VC 2003 VC7 results.

[source lang=cpp]// with ---------------------------------------------------------------------DECLARE_INSTANCE_TYPE(const Cparam);errors:test_sq.cpp(44) : warning C4114: same type qualifier used more than oncetest_sq.cpp(44) : warning C4114: same type qualifier used more than once// (const CParam) expands to 'const const' in the getname footest_sq.cpp(44) : error C2084: function 'void SqPlus::Push(HSQUIRRELVM,const Cparam *)' already has a body        test_sq.cpp(44) : see previous definition of 'Push'test_sq.cpp(44) : error C2664: 'CreateNativeClassInstance' : cannot convert parameter 3 from 'const Cparam *' to 'SQUserPointer'        Conversion loses qualifierstest_sq.cpp(44) : warning C4114: same type qualifier used more than oncetest_sq.cpp(44) : error C2084: function 'void SqPlus::Push(HSQUIRRELVM,const Cparam &)' already has a body        test_sq.cpp(44) : see previous definition of 'Push'test_sq.cpp(44) : warning C4114: same type qualifier used more than oncetest_sq.cpp(44) : error C2084: function 'bool SqPlus::Match(SqPlus::TypeWrapper<T>,HSQUIRRELVM,int)' already has a body        with        [            T=const Cparam &        ]        test_sq.cpp(44) : see previous definition of 'Match'test_sq.cpp(44) : warning C4114: same type qualifier used more than oncetest_sq.cpp(44) : warning C4114: same type qualifier used more than oncetest_sq.cpp(44) : error C2084: function 'const Cparam &SqPlus::Get(SqPlus::TypeWrapper<T>,HSQUIRRELVM,int)' already has a body        with        [            T=const Cparam &        ]        test_sq.cpp(44) : see previous definition of 'Get'............// with ---------------------------------------------------------------------DECLARE_INSTANCE_TYPE(Cparam);------ Build started: Project: test_sq, Configuration: Debug Win32 ------Compiling...test_sq.cpp(1059) : error C2665: 'SqPlus::Match' : none of the 27 overloads can convert parameter 1 from type 'SqPlus::TypeWrapper<T>'        with        [            T=const Cparam *        ]        (632): could be 'bool SqPlus::Match(SqPlus::TypeWrapper<T>,HSQUIRRELVM,int)'        ..........        ..........        ..........        with        [            with        [            Callee=ClassClass,            Func=void (__thiscall ClassClass::* )(const Cparam *)        ]        (1457) : see reference to function template instantiation 'void SqPlus::sq_pushdirectinstanceclosure<Callee,Func>(HSQUIRRELVM,const Callee &,Func,SQUnsignedInteger)' being compiled        with        [            Callee=ClassClass,            Func=void (__thiscall ClassClass::* )(const Cparam *)        ]        (1852) : see reference to function template instantiation 'void SqPlus::RegisterInstance<TClassType,Func>(HSQUIRRELVM,HSQOBJECT,Callee &,Func,const SQChar *)' being compiled        with        [            TClassType=ClassClass,            Func=void (__thiscall ClassClass::* )(const Cparam *),            Callee=ClassClass        ]        test_sq.cpp(97) : see reference to function template instantiation 'SqPlus::SQClassDef<TClassType> &SqPlus::SQClassDef<TClassType>::func<void(__thiscall ClassClass::* )(const Cparam *)>(Func,const SQChar *)' being compiled        with        [            TClassType=ClassClass,            Func=void (__thiscall ClassClass::* )(const Cparam *)        ](1061) : error C2665: 'SqPlus::Get' : none of the 29 overloads can convert parameter 1 from type 'SqPlus::TypeWrapper<T>'        with        [            T=const Cparam *        ]test_sq - 2 error(s), 0 warning(s)/*and SQPLUS_CONST_OPT is defined because the reference macro jumps to#define DECLARE_INSTANCE_TYPE(TYPE) DECLARE_INSTANCE_TYPE_NAME_(TYPE,TYPE)*/#ifndef SQPLUS_CONST_OPT#define DECLARE_INSTANCE_TYPE(TYPE) DECLARE_INSTANCE_TYPE_NAME_(TYPE,TYPE)


[Edited by - Marius on June 6, 2006 12:10:35 PM]
MCO
re: file paths: I use paths relative to the current directory. You can write script functions and/or bind C++ functions to return strings to the current directory, absolute directory, etc., if needed:

dofile("Scripts/commonInit.nut");
// ScriptDir has been initialized to the full path to the script directory:
dofile(ScriptDir+"commonInit.nut");

re: additional issues: perhaps ask the question(s) on the Squirrel forum. If the problem has not been previously noted and solved, perhaps post the (general/complete) solution if you can find one.
Hello John,
I really apreciate yours answers. Thank you.

MCO
I post at squirel forum home page
the workaround for sqplus to suport:

exporting Interfaces,
exporting Const and Volatile (of same type) paramaters in exported methods.
as:
class{
method(const Obj*, Obj*);
foo_set(const Obj*);
foo_get(Obj*);
}
.

Also I worked out include files paths for dofile("bla").
If interested please let me know. Is a functional fix
not quite 'academique'.

I post there under the name of 'suiram'
MCO

This topic is closed to new replies.

Advertisement