【问题标题】:Compilation error when using LuaPlus使用 LuaPlus 时出现编译错误
【发布时间】:2013-10-28 03:25:16
【问题描述】:

我找到了一个关于如何使用 Visual Studio 2010 将 LuaPlus 实现到 C++ 项目中的很好的教程。
http://www.zynox.net/luaplus-1-compiling-basic-usage/ 但由于一些错误消息,我无法让它工作..

mainproject\main.cpp(51): error C2664: ‘GetCurrentDirectoryW’ : cannot convert parameter 2 from ‘char [260]‘ to ‘LPWSTR’

50. char pPath[ MAX_PATH ];
51. GetCurrentDirectory(MAX_PATH,pPath);
52. strcat_s(pPath,MAX_PATH,"\\test.lua");

我尝试使用 TCHAR 代替 char,但随后显示:

no instance of overloaded function “strcat_s” matches the argument list

所以出于测试目的,我只是删除了这三行并用静态路径替换它们:

const char* pPath = "C:\\Users\\fancyBubble\\Documents\\Visual Studio 2010\\Projects\\LuaPlusTutorial\\MainProject\\test.lua";

现在我明白了:

fatal error LNK1104: cannot open file ‘..\Debug\LUAPlus.lib’

我完全不知道如何解决这个问题。 我什至尝试使用教程创建者可能使用的相同版本的 LuaPlus,但错误消息并没有消失。

【问题讨论】:

  • 确保UNICODE 没有被 定义,否则来自winbase.h 的宏会将GetCurrentDirectory 替换为GetCurrentDirectoryW。您还可以显式使用非 unicode 版本GetCurrentDirectoryA
  • 谢谢,我把它改成了“多字节字符集”,这修复了第一个错误……但是“致命错误”仍然存在。

标签: c++ lua luaplus


【解决方案1】:

我真的不知道我做错了什么,但管理员上传了整个解决方案:
http://www.zynox.net/?wpfb_dl=3

将此与greatwolf的评论结合使用,效果很好。 :)

【讨论】:

    猜你喜欢
    • 2020-09-19
    • 2013-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多