我可以下载源代码SQLite Amalgamation和 我如何制作x86和x64位的lib文件?
答案 0 :(得分:0)
我可以找出另一种解决方案。如何构建静态库? 然后这个库在Visual Studio项目中使用。
下载源代码Sqlite Source Code
提取文件夹后复制文件夹
在visual studio上创建项目
Win32 - > Win32项目
下一步 - >选择静态库 - >空项目
完成
打开项目文件夹并将sqlite文件粘贴到项目文件夹
右键单击visual studio中的项目文件夹并选择添加现有项目
包含所有文件后。
构建发布模式(x86和x64)
答案 1 :(得分:0)
我做到了这一点。首先,我可以看到你的问题被标记为visual-c ++。编译器仍然不支持长文件(行数大于65535)。因此,您需要使用SQLite website处提供的split-sqlite3c.tcl脚本拆分sqlite源代码。请参阅here我的问题到SQLite用户组和D Richard Hipp的回答:
D. Richard Hipp的说明: http://sqlite.org:8080/cgi-bin/mailman/private/sqlite-users/2012-March/037690.html
获取该副本 split-sqlite3c.tcl http://www.sqlite.org/src/artifact/d9be87f1c34028脚本和合并的副本。运行
tclsh split-sqlite3c.tcl
您可能需要安装tclsh http://www.activestate.com/activetcl
上面的脚本将生成以下文件:
sqlite3-all.c sqlite3-1.c sqlite3-2.c sqlite3-3.c sqlite3-4.c sqlite3-5.c
使用sqlite3-all.c进行编译,它将#include所有其他内容。 - D. Richard Hipp drh at sqlite.org
请注意,您只需要拆分调试版本的文件。对于发布版本,只需使用来自合并的源代码。
我创建了一个VC项目,根据配置(Debug或Release)使用任一版本(拆分或不拆分)。这是项目文件(vcxproj)源:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A39019F1-A5BD-4A44-9BD4-D01391E975F1}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>SQLib3Am</RootNamespace>
<SccProjectName>SAK</SccProjectName>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<MinimumRequiredVersion>5.00</MinimumRequiredVersion>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<MinimumRequiredVersion>5.00</MinimumRequiredVersion>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="sqlite3.h" />
<ClInclude Include="sqlite3ext.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="shell.c" />
<ClCompile Include="sqlite3-1.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sqlite3-2.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sqlite3-3.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sqlite3-4.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sqlite3-5.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sqlite3-all.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sqlite3.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="sqlite3.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
要使用上述源,请创建一个文件夹,并在此文件夹中使用vcxproj扩展名创建一个空文件。将上述源放入此文件中。将sqlite源从合并复制到同一文件夹中。将tcl脚本复制到同一文件夹并运行它以拆分文件。现在,使用Visual Studio打开vcxproj文件(双击)并编译。你将拥有你的lib文件。
请注意,该文件适用于VC2010。但您可以非常轻松地将其转换为更高版本。