Lua 5.2 Compiling for Windows

Source: Internet
Author: User
Tags lua

<title>Lua 5.2 Compiling for Windows</title> 1 Downloads Lua Source: HTTP://WWW.LUA.ORG/FTP/2 compiled, compiled in two ways. 1 compile with VS compiler 2 with vs command-line
Compile with vs: (I don't understand) http://www.cnblogs.com/cydonia/archive/2013/02/04/2892051.html
:(simpler to compile with the command line) http://blog.csdn.net/zjg555543/article/details/11814563
I looked for it online and created a new mylua.bat in the LUA directory. It's good to run under the VS command line. The contents are as follows:
CD src
CL/O2/W3/C/dlua_build_as_dll l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
Cd..


CD src
CL/O2/W3/C/dlua_build_as_dll l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
CL/O2/W3/C/dlua_build_as_dll LUA.C
Link/out:lua.exe Lua.obj Lua52.lib
Cd..


CD src
CL/O2/W3/C/dlua_build_as_dll l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
CL/O2/W3/C/dlua_build_as_dll lua.c LUAC.C
Link/out:lua.exe Lua.obj Lua52.lib
Del Lua.obj
Link/out:luac.exe L*.obj
Cd..

Then I changed it again: (Put the compiled files into the Lib directory, this is enough)
If exist Lib Rd lib/q/s
MD Lib
cd Lib
CL/O2/W3/C/dlua_build_as_dll. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.objlink/lib/out:lua52_s.lib L*.obj
CL/O2/W3/C/dlua_build_as_dll. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
CL/O2/W3/C/dlua_build_as_dll. /src/lua.c
Link/out:lua.exe Lua.obj Lua52.lib

CL/O2/W3/C/dlua_build_as_dll. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
CL/O2/W3/C/dlua_build_as_dll. /src/lua.c. /src/luac.c
Link/out:lua.exe Lua.obj Lua52.lib
Del Lua.obj
Link/out:luac.exe L*.obj

Cd..
Exit
Includes various static libraries and dynamic libraries if exist Lib Rd lib/q/s
MD Lib
cd Lib

CL/O2/W3/C/dlua_build_as_dll. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
Link/lib/out:lua52_s.lib L*.obj

CL/O2/W3/C/DLUA_BUILD_AS_DLL/MD. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52_md.dll L*.obj

CL/O2/W3/C/DLUA_BUILD_AS_DLL/MDD. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52_mdd.dll L*.obj

CL/O2/W3/C/DLUA_BUILD_AS_DLL/MT. /src/l*.c
Del Lua.obj luac.obj
Link/lib/out:lua52_mt_s.lib L*.obj

CL/O2/W3/C/DLUA_BUILD_AS_DLL/MTD. /src/l*.c
Del Lua.obj luac.obj
Link/lib/out:lua52_mtd_s.lib L*.obj

CL/O2/W3/C/dlua_build_as_dll. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
CL/O2/W3/C/dlua_build_as_dll. /src/lua.c
Link/out:lua.exe Lua.obj Lua52.lib

CL/O2/W3/C/dlua_build_as_dll. /src/l*.c
Del Lua.obj luac.obj
Link/dll/out:lua52.dll L*.obj
CL/O2/W3/C/dlua_build_as_dll. /src/lua.c. /src/luac.c
Link/out:lua.exe Lua.obj Lua52.lib
Del Lua.obj
Link/out:luac.exe L*.obj

Cd..
Exit


------------------------------attached: Test lua

Add a CPP file to test

#include <iostream>
using namespace Std;

#include <lua.hpp>

int main ()
{
Lua_state *l = Lual_newstate ();
Lual_openlibs (l);
Lual_dofile (L, "Main.lua");
Lua_close (l);
System ("pause");
return 0;
}

ADD a LUA script

1 Print ("helloWorld");


From for notes (Wiz)

Lua 5.2 Compiling for Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.