Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8236125

Windows (MSVC 2013) build fails in jpackage: Need to include strsafe.h after tchar.h

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 14, 15
    • Fix Version/s: 15
    • Component/s: tools
    • Labels:
    • Environment:
    • Subcomponent:
    • Resolved In Build:
      b06

      Backports

        Description

        * For target support_native_jdk.incubator.jpackage_libjpackage_WindowsRegistry.obj:
        WindowsRegistry.cpp
        c:\progra~2\micros~1.0\vc\include\tchar.h(24) : fatal error C1189: #error : Need to include strsafe.h after tchar.h
           ... (rest of output omitted)

        Simple fix is to change the order of includes as error message wants it:

        diff -r b8b54ebb450a src/jdk.incubator.jpackage/windows/native/libjpackage/WindowsRegistry.cpp
        --- a/src/jdk.incubator.jpackage/windows/native/libjpackage/WindowsRegistry.cpp Tue Dec 17 10:00:55 2019 +0900
        +++ b/src/jdk.incubator.jpackage/windows/native/libjpackage/WindowsRegistry.cpp Tue Dec 17 21:42:11 2019 +0300
        @@ -24,8 +24,8 @@
          */
         
         #include <Windows.h>
        +#include <tchar.h>
         #include <strsafe.h>
        -#include <tchar.h>
         #include <jni.h>
         
         #include "Utils.h"

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  akasko Alex Kasko
                  Reporter:
                  shade Aleksey Shipilev
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: