Tencent / sluaunreal

lua dev plugin for unreal engine 4 or 5
Other
1.71k stars 411 forks source link

sluaunreal-2.1.2 中 MyGameInstance.h 导致编译报错 #568

Closed mail555 closed 7 months ago

mail555 commented 7 months ago

UE5.2.1 使用 sluaunreal-2.1.2 中 MyGameInstance.h 时报错:

MyGameInstance.h(14): error C2079: “UMyGameInstance”使用未定义的 class“DEMOCPP_API” MyGameInstance.h(14): error C2143: 语法错误: 缺少“;”(在“:”的前面) MyGameInstance.h(14): error C2059: 语法错误:“public” MyGameInstance.h(15): error C2143: 语法错误: 缺少“;”(在“{”的前面) MyGameInstance.h(15): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)

去掉 DEMOCPP_API 后编译通过,但按“安装使用”中添加helloworld.lua 后在 Output Log中Cmd下输入slua::LuaVar v = state->doFile("helloworld");并未出现hello world的输出。 请确认sluaunreal-2.1.2 中 MyGameInstance.h和MyGameInstance.cpp 代码是否完整或“安装使用”文档是否有遗漏内容,谢谢

zjhongxian commented 7 months ago

DEMOCPP_API 不需要也是OK的(因为它不需要导出给其他模块使用),具体5.2.1版本可能并没有编译过(编译的5.2版本),可以帮忙PR一下把UMyGameInstance类的DEMOCPP_API标签去掉。

我升了下到5.2.1编译也没有问题,你可以试试rebuild,或者去掉DEMOCPP_API。

zjhongxian commented 7 months ago

"去掉 DEMOCPP_API 后编译通过,但按“安装使用”中添加helloworld.lua 后在 Output Log中Cmd下输入slua::LuaVar v = state->doFile("helloworld");并未出现hello world的输出。" 这个命令应该是还不支持。