-1

I included wtsapi32 header file in c++ code in windows (using Mingw).

#define _WIN32_WINNT _WIN32_WINNT_WINXP
#include "wtsapi32.h"

I am getting an error says,

c:\mingw\include\wtsapi32.h:200:3: error: 'WTS_VIRTUAL_CLASS' has not been declared

Narendra Prasath
  • 1,501
  • 1
  • 10
  • 20
  • Possible duplicate of [error: Class has not been declared despite header inclusion, and the code compiling fine elsewhere](https://stackoverflow.com/questions/6554492/error-class-has-not-been-declared-despite-header-inclusion-and-the-code-compil) – Adelin Jul 03 '18 at 10:41
  • here the error comes in windows default header files, data type is not defined @Adelin – Narendra Prasath Jul 03 '18 at 10:48
  • @ImmortaleVBR I am using `Windows 10`. Is that any problem? – Narendra Prasath Jul 03 '18 at 10:52
  • how interesting used operation system can affect compiler errors ? `_WIN32_WINNT _WIN32_WINNT_WINXP` faster error in this because [`_WTS_VIRTUAL_CLASS`](https://learn.microsoft.com/en-us/windows/desktop/api/wtsapi32/ne-wtsapi32-_wts_virtual_class) define from Vista. also you use not standard headers files, but from *mingw*. possible it wrong/incomplete – RbMm Jul 03 '18 at 11:41
  • @RbMm I was trying to get access token from `WTSQueryUserToken` method. Can you give me some reference to use this? – Narendra Prasath Jul 03 '18 at 12:21
  • but your question about compiler error(s) – RbMm Jul 03 '18 at 12:22

1 Answers1

1

@RbMm is likely right - this is probably a mingw thing. Anyway, this definition is not going to change so you can just declare the enum in your own code, see here (thank you for the link, @RbMm):

typedef enum _WTS_VIRTUAL_CLASS {
  WTSVirtualClientData  ,
  WTSVirtualFileHandle
} WTS_VIRTUAL_CLASS;
Paul Sanders
  • 24,133
  • 4
  • 26
  • 48