We help IT Professionals succeed at work.

Issues When Using NMAKE To Compile Detours...

SteveDXL
SteveDXL used Ask the Experts™
on
Hey,
So I'm trying to compile Detours 3.0 with NMAKE... and getting nothing but issues.

Here's the command-line output

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin>nmake /f "C:\Program
Files (x86)\Microsoft Research\Detours Express 3.0\system.mak"

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

Open in new window


It just gives a generic output.

Then I cd into the Microsoft Detours Directory, and type only "nmake" and it gives the following output:

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cd "c:\Program Files (x86)\Microsoft Research\Detours Express 3.0\src"
        if not exist "..\include" mkdir "..\include"
        if not exist "..\lib.X86" mkdir "..\lib.X86"
        if not exist "..\bin.X86" mkdir "..\bin.X86"
        if not exist "obj.X86" mkdir "obj.X86"
        cl /W4 /WX /Zi /MTd /Gy /Gm- /Zl /Od /DWIN32_LEAN_AND_MEAN /D_WIN32_WINN
T=0x403 /Gs /DDETOURS_X86=1 /DDETOURS_32BIT=1 /D_X86_ /Fd..\lib.X86\detours.pdb
/Foobj.X86\detours.obj /c .\detours.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

detours.cpp
.\detours.cpp(1057) : error C2065: 'ARRAYSIZE' : undeclared identifier
.\detours.cpp(1585) : warning C4018: '>' : signed/unsigned mismatch
.\detours.cpp(1599) : error C2065: '__debugbreak' : undeclared identifier
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\VC98
\bin\NMAKE.EXE"' : return code '0x2'
Stop.

Open in new window


I doubt Microsoft would release this with these errors in it, so what's going ON?!

Also tried opening system.mak in Visual Studio and it just went to a blank screen.

There is slim-to-no help about this on the net
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
you may look for the vcvars32.bat in the vc\bin folder and call it before calling nmake.

it sets the environment variables (for example INCLUDE and LIB) necessary to make builds at the commandline.

Sara

Author

Commented:
Did not help :(

I think the problem may have been that "nmake" was calling the visual studio 6 version of nmake, and hence using all of those headers and libraries which are outdated. Now I uninstalled msvs6, and repaired visual studio 2010, and am getting the following:

C:\Users\Steve>nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.

Open in new window


:(!

When I run nmake directly from the vs2010\bin, it only outputs that the makefile is up-to-date, or outputs nothing at all.

This is such a nightmare, why can't they just make it simple to build makefiles...
Top Expert 2016
Commented:
you need to run the vcvars32.bat or otherwise the cl (compiler+linker) of vs2010 could not be found and neither the folderd for header files and libraries. i also think you would have the right nmake after running the batch file but to make it sure you could change the PATH environment variable by

 set PATH="...\vc\bin";%PATH%

where the ... must be replaced by the full path to the vc\bin folder of vs2010.

Sara

Author

Commented:
Wonderful solution thank you