iFarbod
iFarbod

Reputation: 639

How to compile Detours Express 3.0?

I have been recently trying to compile Microsoft's Detours library, The free version which is called "Express 3.0". In its README guide it's telling to use 'nmake'. I've opened a command window at the detours directory and tried 'nmake'. It said: "nmake is not recognized as an internal command ...".

I've opened VS2015 x86 Native tools command prompt, used cd to change the current directory to that folder, then tried 'nmake all':

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>

What should I do? I use Windows 10 and Visual Studio 2015.

Upvotes: 1

Views: 5630

Answers (2)

Rui ZHOU
Rui ZHOU

Reputation: 46

Open "\src\Makefile" in your "Detours Express 3.0" Directory.

Modify line 19 as follows:

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

which means to change option "/W4" to "/W3" and remove option "/WX".

then redo "nmake".

Your problem will be solved.

Upvotes: 3

JJF
JJF

Reputation: 2777

The compiler is telling you it is going to treat warnings as errors. That means if you have any warnings the compilation will fail. You have warnings.

Try removing the /WX flag to the compiler in the make file or add the /Wv:18 flag the compiler is suggesting to you.

Upvotes: 0

Related Questions