【发布时间】:2018-01-22 20:20:51
【问题描述】:
大家好,很抱歉问这个问题,但我还没有在网上找到答案。所以我在编译我的一个项目时不断收到错误““const char *”类型的arg与“LPSTR”类型的参数不兼容”。当我将它发送给我的朋友相同的代码时,他可以编译它的所有内容都在使用 Visual Studio 2017 的 Windows 10 上。这是源代码
void RunProcess()
{
runSetDebugPrivs();
while (!FindProcessName("csgo.exe", &__gameProcess)) Sleep(12);
while (!(getThreadByProcess(__gameProcess.th32ProcessID))) Sleep(12);
__HandleProcess = OpenProcess(PROCESS_ALL_ACCESS, false, __gameProcess.th32ProcessID);
while (__dwordClient == 0x0) __dwordClient = GetModuleNamePointer("client.dll", __gameProcess.th32ProcessID);
while (__dwordEngine == 0x0) __dwordEngine = GetModuleNamePointer("engine.dll", __gameProcess.th32ProcessID);
while (__dwordVGui == 0x0) __dwordVGui = GetModuleNamePointer("vguimatsurface.dll", __gameProcess.th32ProcessID);
__HWNDCss = FindWindow(NULL, "Counter-Strike: Global Offensive");
}
};
【问题讨论】:
-
我打赌你使用的是 MSVC 15.5 或更高版本,而你的朋友没有。
-
错误在线 while (__dwordClient == 0x0) __dwordClient = GetModuleNamePointer("client.dll", __gameProcess.th32ProcessID); while (__dwordEngine == 0x0) __dwordEngine = GetModuleNamePointer("engine.dll", __gameProcess.th32ProcessID); while (__dwordVGui == 0x0) __dwordVGui = GetModuleNamePointer("vguimatsurface.dll", __gameProcess.th32ProcessID);所以 7 8 和 9
-
进入你的项目选项,找到C/C++\Language下的“Conformance Mode”选项,将其改为“No”。如果你认真学习 C++,你应该得到一个good book,并确保在你未来的项目中这个选项是“是”。
-
非常感谢,我正在制作一些电子书
标签: c++ visual-studio compilation