在Windows visual studio环境下编译Lua

最近才开始接触Lua,发现很对教学视频还有资料都是基于Lunix。找了好久才找到可行的编译lua的方法


准备阶段:

在lua.org上下载最新的lua

Windows上安装visual studio


实践过程

1、打开VS,new->project->other project types->blank solution->name: Lua_build->OK
2、solution explorer->右键solution:Lua_build->add new project->visual c++
      ->empty project->name:Lua_lib->OK
3、solution explorer->右键Lua_lib->add existing item->找到lua的src,添加所有文件(Lua.c,Luac.c除外)
4、solution explorer->右键Lua_lib->properties->configuration properties->general->
      configuration type->static library ->OK
5、solution explorer->右键Lua_lib->build
6、solution explorer->右键solution:Lua_build->open folder in file explorer->debug->出现Lua-lib.lib
7、solution explorer->右键solution:Lua_build-> add new project->visual c++
      ->empty project->name:Lua->OK
8、添加lua.c到Lua的source files->solution explorer->右键Lua->properties->configuration properties
     ->linker->input->addtional dependencies->单击下拉按钮,填写Lua_lib.lib->OK
                   ->general->addtional library directories->单击下拉按钮,填写Lua_lib.lib所在目录->OK
9、同样的方法(7,8)设置Luac(命名为Luac,添加Luac.c,其他步骤一样)
10、solution explorer->右键solution:Lua_build->build
11、Lua_lib.lib目录下生成Lua.exe,Luac.exe

运行Lua.exe,可以输入lua语句并执行
也可以用Lua.exe运行.lua文件

Luac.exe是lua的编译器,可以将.lua文件处理产生.out文件,并用Lua.exe执行

如有疑问或者习惯使用中文VS,参考http://download.csdn.net/detail/linkhai/8674255

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值