Jump to content
  • Advertisement
Sign in to follow this  
BiiXteR

Intellisense Errors in LuaBridge Source, and more.

This topic is 705 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Me again, with another LuaBridge problem, once again I can't find a solution to it. >.>

 

This time I tried using this code : 

void LuaManager::LinkFunctionsWithScript(const std::string& file)
{
	if (mLuaScripts.find(file)->second == nullptr)
	{
		gDebugger.PrintError(__FILE__, "Could not link script '" + file + "' with C++ functions, the script file could not be found.");
		return;
	}

	luabridge::getGlobalNamespace(mLuaScripts.find(file)->second)
		.beginClass<Debugger>("Debugger")
		.addConstructor<void*>()

		.addFunction("PrintError", &Debugger::PrintError)
		
		.endClass();

}

Which results in build errors in Namespace.h (which is a part of LuaBridge) : 

namespace.h(857): error C2039: 'Params': is not a member of 'luabridge::FuncTraits<MemFn,MemFn>'
namespace.h(857): note: see declaration of 'luabridge::FuncTraits<MemFn,MemFn>'

And when checking the rest of the file I noticed several other intellisense errors : 

identifier 'rawgetfield' is undefined (line 223)
identifier 'getIdentityKey' is undefined (line 266)
identifier 'rawsetfield' is undefined (line 289)

/* The weird thing here, to me, is that the same functions are used several times more without getting any errors
and I've heard that intellisense isn't that trustable, so maybe this is nothing? */

name followed by '::' must be a class or namespace name (line 276)

/* And then those same errors repeat SOMETIMES troughout the entire file, some times it uses the same function and says it's an error, and sometimes not. */

When looking around some more I also noticed more intellisense errors in Stack.h, dump.h.

 

And once again I have no idea whats going on.

 

(And just to prevent me from spamming this forum so much, maybe you could tell me the steps I should do to solve this problem on my own? >.< )

Share this post


Link to post
Share on other sites
Advertisement
The line
.addConstructor<void*>()
looks suspicious to me. The documentation for the addConstructor() function in Namespace.h says this:

The template parameter should be a function pointer type that matches
      the desired Constructor (since you can't take the address of a Constructor
      and pass it as an argument).
I suspect that when you pass a void*, it resolves to the structure on line 58 of FuncTraits.h, that doesn't typedef Params.

Most likely, you need to actually pass a function pointer type, ie something like:

.addConstructor<void (*)(void)>()
This specifies a function pointer type to a function that returns void and takes void for parameters, which matches a constructor taking no parameters.

If the constructor does take parameters (say, for example, a void * or something, like maybe what you are trying to do) you would invoke it as:

.addConstructor<void (*)(void *)>()
This specifies a constructor that takes a void * as an input parameter.

As for the Intellisense errors, I honestly couldn't say since I don't use VS. But I understand it is possible to have Intellisense errors even in projects that build correctly, depending on settings or visibility of include headers and whatnot.

Share this post


Link to post
Share on other sites

The line

.addConstructor<void*>()
looks suspicious to me. The documentation for the addConstructor() function in Namespace.h says this:

The template parameter should be a function pointer type that matches
      the desired Constructor (since you can't take the address of a Constructor
      and pass it as an argument).
I suspect that when you pass a void*, it resolves to the structure on line 58 of FuncTraits.h, that doesn't typedef Params.

Most likely, you need to actually pass a function pointer type, ie something like:

.addConstructor<void (*)(void)>()
This specifies a function pointer type to a function that returns void and takes void for parameters, which matches a constructor taking no parameters.

If the constructor does take parameters (say, for example, a void * or something, like maybe what you are trying to do) you would invoke it as:

.addConstructor<void (*)(void *)>()
This specifies a constructor that takes a void * as an input parameter.

As for the Intellisense errors, I honestly couldn't say since I don't use VS. But I understand it is possible to have Intellisense errors even in projects that build correctly, depending on settings or visibility of include headers and whatnot.

 

 

Oh I have never seen a line like "void (*)(void)" before, but I did some reading and I understand now :)

It compiles perfectly now, thank you.

 

And all the intellisense errors are gone now, so I think I was correct about intellisense messing with me.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!