syntax error : missing ';' before identifier 'PVOID64' when compiling winnt.h

前端 未结 6 1070
夕颜
夕颜 2021-01-04 10:57

I\'ve recently got the source-code on a application. When im trying to build the solution, I get an error in all parts where winnt.h is included. The error code

相关标签:
6条回答
  • 2021-01-04 11:05

    You need to include windows.h rather than winnt.h. When you include windows.h it will, in turn, include winnt.h. You need to do it this way for the necessary macros to be in place that are needed to compile winnt.h.

    In this case, POINTER_64 is defined in BaseTsd.h like this:

    #define POINTER_64 __ptr64
    

    But if you include winnt.h before including windows.h then POINTER_64 is not defined.

    0 讨论(0)
  • 2021-01-04 11:10

    Try to remove DirectX SDK if you have one.

    Here bug is accepted: http://connect.microsoft.com/VisualStudio/feedback/details/508204/vc10-0-errors-while-compiling-winnt-h

    0 讨论(0)
  • 2021-01-04 11:10

    Corrected manually syntax in winnt.h :

    typedef void * POINTER_64 PVOID64; => typedef void * POINTER_64, * PVOID64;
    
    0 讨论(0)
  • 2021-01-04 11:14

    If you are using DirectX SDK, try changing the VC++ Directories for include and lib to be searched last.

    0 讨论(0)
  • 2021-01-04 11:20

    It looks like your configuration of the Windows SDK is invalid. This error is caused by the fact that the compiler is unable to recognize the 'POINTER_64' statement. You may workaround this problem by replacing 'POINTER_64' with '__ptr64'.

    I had the same issue recently. Then I've reinstalled the latest version of the Windows SDK and this fixed the problem.

    UPDATE @David Heffernan, correctly points to the fact that one should include windows.h instead of winnt.h

    0 讨论(0)
  • 2021-01-04 11:27

    If you are using librdkafka, you will get this error whenever "Windows.h" included.

    I fixed it by rename "librdkafka/include/basetsd.h" to a different name, or access this library header via sub path!

    I think the author of this library made this file to deal with OS platform compatibility. But with the same file name "basetsd.h" as Windows Core, it just confusing Visual Studio.

    0 讨论(0)
提交回复
热议问题