gpt4 book ai didi

visual-studio-2012 - vs2012上的弯路编译(Windows 8.1)

转载 作者:行者123 更新时间:2023-12-04 18:08:08 25 4
gpt4 key购买 nike

使用 Visual Studio 2012 命令工具(即在“ native 工具命令提示符”命令控制台中),我运行了 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com