<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