2016-09-25 44 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,但它似乎沒有解決您的問題。

相關問題