I am trying to compile a program that binds a class so that I can use it with a squirrel script.
I am using VS2010 under Windows 7 and have compiled the squirrel libraries and sqrat using the unicode character set with debug configuration.
The error I get is in \sqrat\sqratclass.h, line 81:
error C2664: 'Sqrat::Class<C>::InitClass' : cannot convert parameter 1 from 'const char *' to 'const Sqrat::string &'
does anybody know what I have to do to get this working properly? Or is this a bug in sqrat? Thank you very much!
This is the c++ file:
#include <iostream>
#include <string>
#include <sqrat.h>
class TestClass
{
public:
int integerVar;
std::wstring stringVar;
void printString() { std::wcout << this->stringVar; }
};
void squirrelPrint(SQChar * text)
{
std::wcout << text << std::endl;
}
int main()
{
HSQUIRRELVM squirrelvm = sq_open(1024);
Sqrat::DefaultVM::Set(squirrelvm);
Sqrat::RootTable().Bind(L"TestClass", Sqrat::Class<TestClass>()
.Func(L"printString", &TestClass::printString)
.Var(L"integerVar", &TestClass::integerVar)
.Var(L"strVar", &TestClass::stringVar));
Sqrat::Script script;
script.CompileFile(L"testfile.nut");
script.Run();
}
EDIT: The line that gives the error is:
InitClass(typeid(*this).name());