使用Visual Studio编译7zip源码

两种方式,一种命令行使用nmake,一种通过visual studio。

0x01 源码下载

http://www.7-zip.org/download.html

0x02 makefile修改

%7z_source%CPPBuild.mak文件第34行附近,找到LFLAGS = $(LFLAGS) -OPT:NOWIN98,删除-OPT:NOWIN98选项

此处不修改,后面nmake会报错,根据提示信息找到对应文件删除该选项也可以。

参考页面:http://www.ski-epic.com/2012_compiling_7zip_on_windows_with_visual_studio_10/index.html

0x03 编译

vs命令提示符工具,cd到%7z_source%CPP7zip目录,执行

nmake NEW_COMPILER=1 MY_STATIC_LINK=1

等待编译结束即可。

0x04 Visual Studio编译

使用VS打开%7z_source%CPP7zipBundlesFormat7zFFormat7z.dsw

在7zCrcOpt.asm和AesOpt.asm两个文件上右键属性,修改其配置信息,如图

参考页面:

http://stackoverflow.com/questions/12387701/error-lnk1104-obj-file-without-any-file-name

http://blog.csdn.net/butwang/article/details/6164933

0x05 The End

原文地址:https://www.cnblogs.com/lniwn/p/7z-VSbuild.html