2015-11-06 75 views
1

我最近一直在试图编译微软的Detours库,这个名为“Express 3.0”的免费版本。在它的README指南中,它告诉使用'nmake'。我在detours目录打开了一个命令窗口并尝试'nmake'。它说:“nmake不被识别为内部命令...”。如何编译Detours Express 3.0?

我打开VS2015的x86本机工具命令提示符下,使用cd到当前目录切换到该文件夹​​,然后试图“NMAKE所有”:

C:\Windows\system32>cd C:\Program Files (x86)\Microsoft Research\Detours Express 3.0 

C:\Program Files (x86)\Microsoft Research\Detours Express 3.0>nmake all 

Microsoft (R) Program Maintenance Utility Version 14.00.23026.0 
Copyright (C) Microsoft Corporation. All rights reserved. 

     cd "C:\Program Files (x86)\Microsoft Research\Detours Express 3.0\src" 
Created ..\include 
Created ..\lib.X86 
Created ..\bin.X86 
Created obj.X86 
     cl /W4 /WX /Zi /MTd /Gy /Gm- /Zl /Od /DDETOURS_BITS=32 /DWIN32_LEAN_AND_MEAN /D_WIN32_WINNT=0x403 /Gs /DDETOURS_X86=1 /DDETOURS_32BIT=1 /D_X86_ /DDETOURS_OPTION_BITS=64 /Fd..\lib.X86\detours.pdb /Foobj.X86\detours.obj /c .\detours.cpp 
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86 
Copyright (C) Microsoft Corporation. All rights reserved. 

detours.cpp 
C:\Program Files (x86)\Windows Kits\8.1\include\um\dbghelp.h(1544): error C2220: warning treated as error - no 'object' file generated 
C:\Program Files (x86)\Windows Kits\8.1\include\um\dbghelp.h(1544): warning C4091: 'typedef ': ignored on left of '' when no variable is declared 
C:\Program Files (x86)\Windows Kits\8.1\include\um\dbghelp.h(3190): warning C4091: 'typedef ': ignored on left of '' when no variable is declared 
.\detours.cpp(156): warning C4456: declaration of 'pbNew' hides previous local declaration 
.\detours.cpp(156): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings 
.\detours.cpp(147): note: see declaration of 'pbNew' 
.\detours.cpp(163): warning C4456: declaration of 'pbNew' hides previous local declaration 
.\detours.cpp(163): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings 
.\detours.cpp(147): note: see declaration of 'pbNew' 
.\detours.cpp(1263): warning C4456: declaration of 'o' hides previous local declaration 
.\detours.cpp(1263): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings 
.\detours.cpp(1112): note: see declaration of 'o' 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2' 
Stop. 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2' 
Stop. 

C:\Program Files (x86)\Microsoft Research\Detours Express 3.0>set DETOURS_TARGET_PROCESSOR=x86 

C:\Program Files (x86)\Microsoft Research\Detours Express 3.0>nmake all 

Microsoft (R) Program Maintenance Utility Version 14.00.23026.0 
Copyright (C) Microsoft Corporation. All rights reserved. 

     cd "C:\Program Files (x86)\Microsoft Research\Detours Express 3.0\src" 
     cl /W4 /WX /Zi /MTd /Gy /Gm- /Zl /Od /DDETOURS_BITS=32 /DWIN32_LEAN_AND_MEAN /D_WIN32_WINNT=0x403 /Gs /DDETOURS_X86=1 /DDETOURS_32BIT=1 /D_X86_ /DDETOURS_OPTION_BITS=64 /Fd..\lib.X86\detours.pdb /Foobj.X86\detours.obj /c .\detours.cpp 
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86 
Copyright (C) Microsoft Corporation. All rights reserved. 

detours.cpp 
C:\Program Files (x86)\Windows Kits\8.1\include\um\dbghelp.h(1544): error C2220: warning treated as error - no 'object' file generated 
C:\Program Files (x86)\Windows Kits\8.1\include\um\dbghelp.h(1544): warning C4091: 'typedef ': ignored on left of '' when no variable is declared 
C:\Program Files (x86)\Windows Kits\8.1\include\um\dbghelp.h(3190): warning C4091: 'typedef ': ignored on left of '' when no variable is declared 
.\detours.cpp(156): warning C4456: declaration of 'pbNew' hides previous local declaration 
.\detours.cpp(156): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings 
.\detours.cpp(147): note: see declaration of 'pbNew' 
.\detours.cpp(163): warning C4456: declaration of 'pbNew' hides previous local declaration 
.\detours.cpp(163): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings 
.\detours.cpp(147): note: see declaration of 'pbNew' 
.\detours.cpp(1263): warning C4456: declaration of 'o' hides previous local declaration 
.\detours.cpp(1263): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings 
.\detours.cpp(1112): note: see declaration of 'o' 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2' 
Stop. 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2' 
Stop. 

C:\Program Files (x86)\Microsoft Research\Detours Express 3.0> 

我该怎么办?我使用Windows 10和Visual Studio 2015.

回答

3

在你的“Detours Express 3.0”目录中打开“\ src \ Makefile”。

修改线19,如下所示:

CFLAGS=/W3 /Zi /MTd /Gy /Gm- /Zl /Od /DDETOURS_BITS=$(DETOURS_BITS) 

这意味着改变选项 “/ W4” 到 “/ W3”,并删除选项 “/ WX”。

然后重做“nmake”。

您的问题将得到解决。

+0

2016年2月,在Windows 10 64位上:作品!谢了哥们 – Mgamerz

0

编译器告诉你它将把警告视为错误。这意味着如果您有任何警告,编译将失败。你有警告。

尝试在编译文件中除去编译器的/WX标志,或添加编译器向您建议的/Wv:18标志。

+0

未解决我的问题 – iFarbod

+0

现在有什么错误? – JJF

+0

我想我不应该用这种方式编译它,会不会更好地创建一个项目是VS(静态库),并把它的文件?然后编译它? – iFarbod