【问题标题】:Windows thread pool, 'PTP_CALLBACK_INSTANCE' : undeclared identifierWindows 线程池,“PTP_CALLBACK_INSTANCE”:未声明的标识符
【发布时间】: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

【问题讨论】:

标签: c++ c windows winapi


【解决方案1】:

您可以从here 下载Windows SDK,然后安装或安装它via Visual Studio

来自维基:

windows.h 是 C 和 C++ 编程语言的特定于 Windows 的头文件,其中包含所有 Windows API 中的函数,Windows 使用的所有常用宏 程序员,以及各种函数使用的所有数据类型和 子系统。

如果您安装 SDK 版本 17134,您可以在此路径下找到它:C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um。

这里的 SDK 代表 Windows 软件开发工具包。安装完成后,您会在控制面板\程序\程序和功能中看到“Windows Software Development Kit-Windows 10.0.17134.12”。

Windows SDK 提供头文件(如 windows.h)、库和工具来帮助您开发 Windows 应用程序。

【讨论】:

  • 得到它!谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-30
  • 1970-01-01
  • 2021-06-07
  • 2016-04-09
相关资源
最近更新 更多