ketoo / NoahGameFrame

A fast, scalable, distributed game server engine/framework for C++, include the actor library, network library, can be used as a real time multiplayer game engine ( MMO RPG/MOBA ), which support C#/Lua script/ Unity3d, Cocos2dx and plan to support Unreal.
https://github.com/ketoo/NoahGameFrame/wiki
Apache License 2.0
3.92k stars 1.09k forks source link

Compile error in dev studio 2019 #310

Closed TanisTheRed closed 3 years ago

TanisTheRed commented 3 years ago

I ran the proper bats before compiling the solution. The errors I am getting are: 'return': cannot convert from 'lua_Number' to 'const lua_Number *' (compiling source file NFLuaPBModule.cpp) 'lua_resume': function does not take 3 arguments (compiling source file NFLuaPBModule.cpp)

LNK1104 cannot open file 'Tutorial5.lib'

I am running windows 10.

Any ideas how to fix this?

TanisTheRed commented 3 years ago

Traced the failures to the LauState.h file: replace: const lua_Number* version() const { return lua_version(L); }

with:
const lua_Number* version() const
{
static const luaNumber versionNum = LUA_VERSION_NUM;
return &versionNum;
}

for some reason they added this but didn't test and the original serves no purpose calling the other function.

The second error is in the following code:  They added a new variable that is not used so we need to just pass a blank in.

if LUA_VERSION_NUM == 501

int resume(int num_args) const
    { return lua_resume(L, num_args); }

else

int resume(int num_args, lua_State* from = nullptr) const
{ return lua_resume(L, from, num_args); }

endif

replace with:

if LUA_VERSION_NUM == 501

int resume(int num_args) const
    { return lua_resume(L, num_args); }

else

int resume(int num_args, lua_State* from = nullptr) const
{
    int nres;
    return lua_resume(L, from, num_args, &nres); 
}

endif

ketoo commented 3 years ago

Sorry for the late reply as I have offline past days.

Great job! The root reason is Lua 5.4 has changed the parameter requirements but Luabind didn't do the same thing.