【发布时间】:2019-05-30 16:30:35
【问题描述】:
VC6.0、Win10、C++。
当我声明一个线程池回调函数时
VOID CALLBACK ProcessHook(PTP_CALLBACK_INSTANCE instance, PVOID lParam);
我编译它并得到一个错误
错误 C2065:“PTP_CALLBACK_INSTANCE”:未声明的标识符
我已经收录了Windows.h
代码
#include <Windows.h>
#include <stdio.h>
VOID CALLBACK ProcessHook(PTP_CALLBACK_INSTANCE instance, PVOID lParam);
结果
c:\users\jasey\windows-program\keyboardhook\keyboardhook.h(33) :
error C2065: 'PTP_CALLBACK_INSTANCE' : undeclared identifier
c:\users\jasey\windows-program\keyboardhook\keyboardhook.h(33) :
error C2146: syntax error : missing ')' before identifier 'instance'
c:\users\jasey\windows-program\keyboardhook\keyboardhook.h(33) : warning C4229: anachronism used : modifiers on data are ignored
【问题讨论】:
-
您好像没有安装合适的Win SDK。你为什么用这么老的 VC 6.0,也就是 20 年了?
-
我已经阅读了 Windows 文档 docs.microsoft.com/en-us/windows/desktop/api/threadpoolapiset/…,它说只需要
Windows.h。 SDK 的名称是什么?用VC6.0,因为它很轻~