0

Got the error : TOKEN_MANDATORY_LABEL and TokenIntegrityLevel not declared in this scope.

I included windows.h and winnt.h :

#include <Windows.h>
#include <winnt.h>

I can redefine TOKEN_MANDATORY_LABEL:

typedef struct _TOKEN_MANDATORY_LABEL {
  SID_AND_ATTRIBUTES Label;
} TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL;

So the problem is solved for TOKEN_MANDATORY_LABEL, but if I redefine TOKEN_INFORMATION_CLASS for TokenIntegrityLevel (https://learn.microsoft.com/en-us/windows/desktop/api/winnt/ne-winnt-_token_information_class) got the message that TOKEN_INFORMATION_CLASS was already declared. I'm compiling using MinGW : g++ sandbox.cpp -o sandbox.exe I probably forget to include something.

François MENTEC
  • 1,150
  • 4
  • 12
  • 25
  • What are you trying to do? What is the problem you try to solve? Why are you attempting to redefine symbols or even structures? And remember that symbols starting with an underscore and followed by an upper-case letter (like e.g. `_TOKEN_MANDATORY_LABEL`) are [reserved for the compiler and standard library everywhere](http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier). – Some programmer dude Jul 28 '18 at 15:49
  • I don't want to redefine anything, did you even read my post? It's just a workaround because I got those error : `error: 'TOKEN_MANDATORY_LABEL' was not declared in this scope` and `error: 'TokenIntegrityLevel' was not declared in this scope`. I just want my program to compile. – François MENTEC Jul 28 '18 at 15:52
  • 1
    how i understand you use not standard windows headers files from sdk, but very old files from g++ – RbMm Jul 28 '18 at 17:11
  • @RbMm so how can I fix that? by using visual studio? – François MENTEC Jul 28 '18 at 17:15
  • task not in visual studio - but in header files and compiler. main - you need use header files from SDK/WDK which you can download from ms site. with this all this symbols will be defined. but how i can guess *g++* simply not understand this files, can not compile it. you need use *cl.exe* compiler. which shell you will be use - nothing affect – RbMm Jul 28 '18 at 17:59

0 Answers0