2016-09-25 114 views
1

我下载了7-zip的最新源代码,以便使用Visual Studio 2015 RC在本地进行编译,但是当我编译时收到了以下错误消息:如何使用Visual Studio 2015编译7-zip rc

C:\7zip\CPP\7zip\UI\GUI>nmake NEW_COMPILER=1 MY_STATIC_LINK=1 

Microsoft (R) Program Maintenance Utility Version 14.00.22816.0 
Copyright (C) Microsoft Corporation. Tous droits réservés. 

     cl -DLANG -DEXTERNAL_CODECS -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE -D_ 
7ZIP_LARGE_PAGES -DUNICODE -D_UNICODE -Gr -nologo -c -FoO/ -W4 -WX -EHsc -Gy -GR 
- -MT -GS- -Zc:forScope -MP2 -O1 -Yu"StdAfx.h" -FpO/a.pch ../../../Common\Lang.c 
pp ../../../Common\Wildcard.cpp 
Lang.cpp 
Wildcard.cpp 
../../../Common\Wildcard.cpp(3): error C2220: avertissement considéré comme une 
erreur - aucun fichier 'object' généré 
../../../Common\Lang.cpp(3): error C2220: avertissement considéré comme une erre 
ur - aucun fichier 'object' généré 
../../../Common\Wildcard.cpp(3): warning C4652: option du compilateur 'prise en 
charge des vérifications de la sécurité (/GS)' non cohérente avec l'en-tête préc 
ompilé ; l'option active de ligne de commande se substituera à celle définie dan 
s l'en-tête précompilé 
../../../Common\Lang.cpp(3): warning C4652: option du compilateur 'prise en char 
ge des vérifications de la sécurité (/GS)' non cohérente avec l'en-tête précompi 
lé ; l'option active de ligne de commande se substituera à celle définie dans l' 
en-tête précompilé 
../../../Common\Wildcard.cpp(3): warning C4651: '/D_DLL' spécifié pour l'en-tête 
précompilé mais non pour la compilation active 
../../../Common\Lang.cpp(3): warning C4651: '/D_DLL' spécifié pour l'en-tête pré 
compilé mais non pour la compilation active 
../../../Common\Lang.cpp(144): warning C4456: la déclaration de 's' masque la dé 
claration locale précédente 
../../../Common\Lang.cpp(144): note: to simplify migration, consider the tempora 
ry use of /Wv:18 flag with the version of the compiler with which you used to bu 
ild without warnings 
../../../Common\Lang.cpp(123): note: voir la déclaration de 's' 
../../../Common\Wildcard.cpp(543): warning C4456: la déclaration de 'front' masq 
ue la déclaration locale précédente 
../../../Common\Wildcard.cpp(543): note: to simplify migration, consider the tem 
porary use of /Wv:18 flag with the version of the compiler with which you used t 
o build without warnings 
../../../Common\Wildcard.cpp(482): note: voir la déclaration de 'front' 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0 
\VC\BIN\cl.EXE"' : code retour '0x2' 
Stop. 

我跟着这个步骤,以编译它,但没有运气:http://www.ski-epic.com/2012_compiling_7zip_on_windows_with_visual_studio_10/index.html

的主要步骤:

Set up the environment variables using "c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat" 
Edit C:\7zsrc\CPP\Build.mak to remove "-OPT:NOWIN98" from line 34 
Run C:\7zsrc\CPP\7zip\nmake NEW_COMPILER=1 MY_STATIC_LINK=1 

请问这里的问题在哪里?

回答

1

我遵循http://www.ski-epic.com/2012_compiling_7zip_on_windows_with_visual_studio_10/index.html的说明,您在“主要步骤”代码框中列出了这些说明,并且成功。我注意到这些指令已经过时了,因为源代码现在分布在.7z文件中。所以“bunzip2”方法对于解包是不必要的。

我做的一件事情略有不同(比你做的)是使用不同的路径到vsvars32.bat文件。我在我的系统上安装了多个版本的visual studio express,最近的版本是VS2015 express。我检查了可能的路径并使用了最近的路径。在我的情况是:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat" 

我注意到,MS PMU版本是比你稍微新一点:

Microsoft (R) Program Maintenance Utility Version 14.00.23918.0 

你可以尝试获得VS1015表示,(不RC版)。我知道最新版本的Visual Studio是VS2017(现在可用),我还没有尝试过。

关于您发布的错误消息,您似乎遇到了预编译头文件(不匹配某些声明)和将警告视为错误的问题。这是您第一次编译的尝试吗?也许以前的尝试对导致问题的默认设置进行了一些更改。我建议你删除源文件夹和之前编译尝试产生的任何残留,并解压缩源文件的干净副本。

注意:这里有一个相关的问题:Cannot compile 7zip under MSVC2012,但它似乎没有解决您的问题。

相关问题