使用Visual Studio 2012命令工具(即在``本地工具命令提示符''命令控制台中)运行vcvars32.bat,并导航到* c:\program file(x86)\Microsoft Research\Detours Express 3.0 *。

在此目录中运行nmake时,它开始成功构建,但是随后退出并显示错误:

cl /nologo /nologo /Zi /MT /Gm- /W4 /WX /Od /DDETOURS_BITS=32 /I..\..\include /Gs /DDETOURS_X86=1 /DDETOURS_32BIT=1 /D_X86_ /DDETOURS_OPTION_BITS=64 /Fdobj.X86\vc.pdb /Foobj.X86\member.obj /c member.cpp

member.cpp
member.cpp(88) : error C2440: 'type cast' : cannot convert from 'void (__thiscall CMember::* )(void)' to 'PBYTE &'
Reason: cannot convert from 'overloaded-function' to 'PBYTE *'
There is no context in which this conversion is possible

member.cpp(90) : error C2440: 'type cast' : cannot convert from 'void (__thiscall CDetour::* )(void)' to 'PBYTE &'
Reason: cannot convert from 'overloaded-function' to 'PBYTE *'
There is no context in which this conversion is possible

// error repeated member.cpp lines 105, 120, 122.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.

不知道如何继续处理此错误。我还试图:
set DETOURS_TARGET_PROCESSOR=X86

然后“nmake clean”,然后是新的“nmake”-但这会导致相同的错误。

如标题中所指定,我正在Windows 8.1框(x64)上使用vs2012进行构建。

谢谢你

最佳答案

好的,所以我解决了这个问题,所以我认为如果有人发现它有用,我会发布答案。

我已经通过反复试验来做到这一点,所以我仍然希望有人来解释这个错误的原因/原因,以及造成它的原因等。

但是,以下是我为了使其能够进行编译而进行的更改:

#if (_MSC_VER < 1310)
    pfTarget = CMember::Target;
    pfMine = CDetour::Mine_Target;

    Verify("CMember::Target", *(PBYTE*)&pfTarget);
    Verify("*CDetour::Real_Target", *(&(PBYTE&)CDetour::Real_Target));
    Verify("CDetour::Mine_Target", *(PBYTE*)&pfMine);
#else
    //Verify("CMember::Target", (PBYTE)(&(PBYTE&)CMember::Target));
    //Verify("*CDetour::Real_Target", *(&(PBYTE&)CDetour::Real_Target));
    //Verify("CDetour::Mine_Target", (PBYTE)(&(PBYTE&)CDetour::Mine_Target));

    pfTarget = &CMember::Target;
    pfMine = &CDetour::Mine_Target;

    Verify("CMember::Target", *(PBYTE*)&pfTarget);
    Verify("*CDetour::Real_Target", *(&(PBYTE&)CDetour::Real_Target));
    Verify("CDetour::Mine_Target", *(PBYTE*)&pfMine);
#endif

我的更改在第二个“else”语句的第二部分中,原始代码已被注释掉。

对于每个错误(原始问题中的相关行号)-我注释掉那里的内容,并从第一部分的“if”部分复制并粘贴,但从“pfTarget = CMember::Target;”更改为“pfTarget =&CMember: :Target;”(基于编译器的指令)。

似乎是两个不同的问题,首先是在if/else块中使用了错误的路径(应该在某个地方设置了_MSC_VER而不是?),其次是从CMember::Target到&CMember::Target的必要更改。

谢谢

关于visual-studio-2012 - vs2012上绕行编译(Windows 8.1),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21591698/

10-13 08:34