首先是从http://www.lua.org/ 下载源代码.
我使用的版本是lua-5.1.4 由于我使用的是VS2003(VC71).所以如果能够创建VC71的工程文件用于编译lua应该是比较方便的事情了.
参考网上的编译经验.我自己成功的创建出了用于编译lua5.1.4的工程文件在此和大家分享:
有两个工程文件(lua51.vcproj和luacmd.vcproj)分别用于编译dll和命令行工具lua.exe
工程文件的内容如下:
lua51.vcproj
ProjectType="Visual C++"
Version="7.10"
Name="lua51"
ProjectGUID="{28AAA965-843E-44FA-8D8A-6D4B717E2C4A}"
Keyword="Win32Proj">
Name="Win32"/>
Name="Debug|Win32"
OutputDirectory="../Bin"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LUA51_EXPORTS;LUA_BUILD_AS_DLL"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
Name="VCCustomBuildTool"/>
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/lua51.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/lua51.lib"
TargetMachine="1"/>
Name="VCMIDLTool"/>
Name="VCPostBuildEventTool"/>
Name="VCPreBuildEventTool"/>
Name="VCPreLinkEventTool"/>
Name="VCResourceCompilerTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCXMLDataGeneratorTool"/>
Name="VCWebDeploymentTool"/>
Name="VCManagedWrapperGeneratorTool"/>
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LUA51_EXPORTS;LUA_BUILD_AS_DLL"
RuntimeLibrary="0"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
Name="VCCustomBuildTool"/>
Name="VCLinkerTool"
OutputFile="../Bin/lua51.dll"
LinkIncremental="1"
GenerateDebugInformation="FALSE"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="../Bin/lua51.lib"
TargetMachine="1"/>
Name="VCMIDLTool"/>
Name="VCPostBuildEventTool"/>
Name="VCPreBuildEventTool"/>
Name="VCPreLinkEventTool"/>
Name="VCResourceCompilerTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCXMLDataGeneratorTool"/>
Name="VCWebDeploymentTool"/>
Name="VCManagedWrapperGeneratorTool"/>
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="源文件"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
RelativePath="./lapi.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lauxlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lbaselib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lcode.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldblib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldebug.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldo.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldump.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lfunc.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lgc.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./linit.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./liolib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./llex.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lmathlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lmem.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./loadlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lobject.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lopcodes.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./loslib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lparser.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lstate.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lstring.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lstrlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ltable.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ltablib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ltm.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lundump.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lvm.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lzio.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./print.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="头文件"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
RelativePath="./lapi.h">
RelativePath="./lauxlib.h">
RelativePath="./lcode.h">
RelativePath="./ldebug.h">
RelativePath="./ldo.h">
RelativePath="./lfunc.h">
RelativePath="./lgc.h">
RelativePath="./llex.h">
RelativePath="./llimits.h">
RelativePath="./lmem.h">
RelativePath="./lobject.h">
RelativePath="./lopcodes.h">
RelativePath="./lparser.h">
RelativePath="./lstate.h">
RelativePath="./lstring.h">
RelativePath="./ltable.h">
RelativePath="./ltm.h">
RelativePath="./lua.h">
RelativePath="./luaconf.h">
RelativePath="./lualib.h">
RelativePath="./lundump.h">
RelativePath="./lvm.h">
RelativePath="./lzio.h">
Name="资源文件"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
RelativePath="./ReadMe.txt">
luacmd.vcproj
ProjectType="Visual C++"
Version="7.10"
Name="luacmd"
ProjectGUID="{06BE0A3C-45BD-46FD-9200-000000000000}"
RootNamespace="luacmd"
Keyword="Win32Proj">
Name="Win32"/>
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
Name="VCCustomBuildTool"/>
Name="VCLinkerTool"/>
Name="VCMIDLTool"/>
Name="VCPostBuildEventTool"/>
Name="VCPreBuildEventTool"/>
Name="VCPreLinkEventTool"/>
Name="VCResourceCompilerTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCXMLDataGeneratorTool"/>
Name="VCWebDeploymentTool"/>
Name="VCManagedWrapperGeneratorTool"/>
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
Name="VCCustomBuildTool"/>
Name="VCLinkerTool"
OutputFile="../Bin/lua.exe"/>
Name="VCMIDLTool"/>
Name="VCPostBuildEventTool"/>
Name="VCPreBuildEventTool"/>
Name="VCPreLinkEventTool"/>
Name="VCResourceCompilerTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCXMLDataGeneratorTool"/>
Name="VCWebDeploymentTool"/>
Name="VCManagedWrapperGeneratorTool"/>
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="源文件"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
RelativePath="./lapi.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lauxlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lbaselib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lcode.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldblib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldebug.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldo.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ldump.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lfunc.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lgc.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./linit.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./liolib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./llex.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lmathlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lmem.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./loadlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lobject.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lopcodes.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./loslib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lparser.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lstate.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lstring.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lstrlib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ltable.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ltablib.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./ltm.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lua.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lundump.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lvm.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./lzio.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
RelativePath="./print.c">
Name="Debug|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="Release|Win32">
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"/>
Name="头文件"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
RelativePath="./lapi.h">
RelativePath="./lauxlib.h">
RelativePath="./lcode.h">
RelativePath="./ldebug.h">
RelativePath="./ldo.h">
RelativePath="./lfunc.h">
RelativePath="./lgc.h">
RelativePath="./llex.h">
RelativePath="./llimits.h">
RelativePath="./lmem.h">
RelativePath="./lobject.h">
RelativePath="./lopcodes.h">
RelativePath="./lparser.h">
RelativePath="./lstate.h">
RelativePath="./lstring.h">
RelativePath="./ltable.h">
RelativePath="./ltm.h">
RelativePath="./lua.h">
RelativePath="./luaconf.h">
RelativePath="./lualib.h">
RelativePath="./lundump.h">
RelativePath="./lvm.h">
RelativePath="./lzio.h">
Name="资源文件"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
RelativePath="./ReadMe.txt">