1
我收到两个错误,无法弄清楚我的生活... 我在过去的几个小时在谷歌研究它。我现在正在哪里。 这是我收到的编译错误。编译错误C3861 Visual Studio 2010
2 IntelliSense: identifier "RegisterShader" is undefined c:\users\administrator\documents\visual studio 2010\projects\test\dllmain.cpp 18 20
Error 1 error C3861: 'RegisterShader': identifier not found c:\users\administrator\documents\visual studio 2010\projects\test\dllmain.cpp 50 1
// stdafx.h中
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// TODO: reference additional headers your program requires here
#include <detours.h>
#include "typedefs.h"
// stdafx.cpp
// stdafx.cpp : source file that includes just the standard includes
// blopsII.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// typedefs.h
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
#define OFF_REGISTERSHADER 0x00715690
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef int qhandle_t;
typedef int (* tRegisterShader)(char* szName, int unk);
#endif
// typedefs.cpp
#include "stdafx.h"
tRegisterShader RegisterShader = (tRegisterShader)OFF_REGISTERSHADER;
// dllmain.cpp
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
//#include "typedefs.h"
DWORD dwHook = 0x6ADC30;
void callback()
{
qhandle_t white = RegisterShader("white", 3);
}
int __cdecl hkRender()
{
_asm pushad;
callback();
_asm popad;
}
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
我包含typedefs.h的文件在stdafx.h里面?我应该把extern只在我的dllmain.cpp中? –
@ Pepsi_1实际上,我会把extern放在你的底部,typedefs.h头文件就在#endif里面,结束了你的岗位。我正准备在这里更新答案,以表明这是另一种选择。 – WhozCraig
感谢它的工作......我不能相信我错过了 –