gpt4 book ai didi

c++不能使用.h头文件的功能

转载 作者:太空狗 更新时间:2023-10-29 21:46:29 25 4
gpt4 key购买 nike

突然我无法使用我在.h 头文件中编写的新函数和我编写的旧函数我可以使用它,我无法相信:S

stdafx.h

#include "function.h"

Hook.h

#include "stdafx.h"

namespace DragoN_Hook
{
void EditOrginalCastleWar(int StartHour,int EndHour){

unsigned char lol[4] = {0x83, 0x7A, 0x08,(unsigned char)StartHour};
MemoryCopy((DWORD)0x00411A05,(DWORD)&lol,4);

}
}

函数.h

LPVOID MemoryCopy(DWORD destination, DWORD source, int length);

函数.cpp

LPVOID MemoryCopy(DWORD destination, DWORD source, int length)
{
DWORD oldSource = 0;
DWORD oldDestination = 0;

VirtualProtect((LPVOID)source,length,PAGE_EXECUTE_READWRITE,&oldSource);
VirtualProtect((LPVOID)destination,length,PAGE_EXECUTE_READWRITE,&oldDestination);

memcpy((void*)destination,(void*)source,length);

VirtualProtect((LPVOID)destination,length,oldDestination,&oldDestination);
VirtualProtect((LPVOID)source,length,oldSource,&oldSource);

return (LPVOID)destination;
};

错误*错误 C3861:“MemoryCopy”:找不到标识符*

最佳答案

这通常发生在您编译和单独的文件时,它不会导致预编译头文件被重建。如果您重建解决方案,它将重新创建 header 。您也可以关闭预编译的 header ,而不必处理它。

关于c++不能使用.h头文件的功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15032083/

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