Windows下Visual Studio 2013编译Lua 5.1.4版本

1、创建一个Visual C++的Empty Project,如果需要支持Windows XP将Platform Toolset设置为Visual Studio 2013 - Windows XP (v120_xp)。

2、Configuration Type设置为Dynamic Library (.dll)。

3、添加对应的源代码文件,但lua.c、luac.c文件除外。

4、C/C++ -> Command Line的Additional Options添加/D _CRT_SECURE_NO_WARNINGS。

5、查看luaconf.h,如果需要导出函数:C/C++ -> Preprocessor添加一个LUA_BUILD_AS_DLL。

6、编译源代码。

7、如果需要lua解释器则建立一个控制台程序并结合lua.c编译。

8、如果需要lua编译器则建立一个控制台程序并结合luac.c编译。

警告解决方案:

警告 1 warning MSB8030: The linker switch "Minimum Required Version" requires "SubSystem" to be set.  Without "SubSystem", the "Minimum Required Version" would not be passed to linker and could prevent to the output binary from running on older Operating 

在项目属性中的Linker->System下,确保设置了子系统属性(对于控制台应用程序,设置为控制台,对于DLL和非控制台应用程序,设置为Windows)。

如果使用公共属性表(*.props)在所有项目中设置项目属性,则可以添加类似这样的内容,以确保在项目未显式指定值的情况下为子系统分配有效值。

转载于:https://www.cnblogs.com/hshy/p/10928093.html

原文地址:https://www.cnblogs.com/welcome-to-fang-qi-blog/p/13181313.html