Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt 5.12.0 MSVC 2017 32 Bit
Forum Updated to NodeBB v4.3 + New Features

Qt 5.12.0 MSVC 2017 32 Bit

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
12 Posts 3 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BrianN
    wrote on last edited by
    #1

    My program was previously able to compile using 5.11.0 and MSVC 2015 32 bit. After installing MSVC2017 and Qt 5.12.0 I get compile errors in winnt.h.

    typedef struct _IMAGE_HOT_PATCH_HASHES {
    BYTE SHA256[32];
    BYTE SHA1[20];
    } IMAGE_HOT_PATCH_HASHES, *PIMAGE_HOT_PATCH_HASHES;

    C2059: Syntax error: 'constant'
    C2238: unexpected token(s) preceeding ';'

    The errors refer to the line BYTE SHA1[20];

    The items appear to be new in Windows Kits 10. I think MSVC 2015 was using Windows Kits 8.0.

    Not sure if it is a relevant test but I created a small test desktop program in VS2017 and included winnt.h and that program compiles correctly.

    Brian

    aha_1980A 1 Reply Last reply
    0
    • B BrianN

      My program was previously able to compile using 5.11.0 and MSVC 2015 32 bit. After installing MSVC2017 and Qt 5.12.0 I get compile errors in winnt.h.

      typedef struct _IMAGE_HOT_PATCH_HASHES {
      BYTE SHA256[32];
      BYTE SHA1[20];
      } IMAGE_HOT_PATCH_HASHES, *PIMAGE_HOT_PATCH_HASHES;

      C2059: Syntax error: 'constant'
      C2238: unexpected token(s) preceeding ';'

      The errors refer to the line BYTE SHA1[20];

      The items appear to be new in Windows Kits 10. I think MSVC 2015 was using Windows Kits 8.0.

      Not sure if it is a relevant test but I created a small test desktop program in VS2017 and included winnt.h and that program compiles correctly.

      Brian

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @BrianN

      Not sure if it is a relevant test but I created a small test desktop program in VS2017 and included winnt.h and that program compiles correctly.

      And after adding:

      typedef struct _IMAGE_HOT_PATCH_HASHES {
      BYTE SHA256[32];
      BYTE SHA1[20];
      } IMAGE_HOT_PATCH_HASHES, *PIMAGE_HOT_PATCH_HASHES;
      

      your minimal program no longer compiles?

      Does it compile if you only add BYTE SHA1[20]; ?

      One more note: _IMAGE_HOT_PATCH_HASHES - symbols starting with underscore _ followed by uppercase letter are reserved for the compiler. Symbols containing two underscores __ anywhere are reserved too.

      Regards

      Qt has to stay free or it will die.

      B 1 Reply Last reply
      0
      • aha_1980A aha_1980

        @BrianN

        Not sure if it is a relevant test but I created a small test desktop program in VS2017 and included winnt.h and that program compiles correctly.

        And after adding:

        typedef struct _IMAGE_HOT_PATCH_HASHES {
        BYTE SHA256[32];
        BYTE SHA1[20];
        } IMAGE_HOT_PATCH_HASHES, *PIMAGE_HOT_PATCH_HASHES;
        

        your minimal program no longer compiles?

        Does it compile if you only add BYTE SHA1[20]; ?

        One more note: _IMAGE_HOT_PATCH_HASHES - symbols starting with underscore _ followed by uppercase letter are reserved for the compiler. Symbols containing two underscores __ anywhere are reserved too.

        Regards

        B Offline
        B Offline
        BrianN
        wrote on last edited by
        #3

        @aha_1980

        Sorry I was not clear. Those lines are in winnt.h in the Windows Kits 10. It is not something I have added. They do not appear in Windows Kits 8.

        A minimal app in VS2017 seems to compile ok with winnt.h included.

        Thanks for your help.

        Brian

        aha_1980A 1 Reply Last reply
        0
        • B BrianN

          @aha_1980

          Sorry I was not clear. Those lines are in winnt.h in the Windows Kits 10. It is not something I have added. They do not appear in Windows Kits 8.

          A minimal app in VS2017 seems to compile ok with winnt.h included.

          Thanks for your help.

          Brian

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @BrianN

          So what is your actual problem, i.e. when do you hit that compile error?

          Qt has to stay free or it will die.

          1 Reply Last reply
          0
          • hskoglundH Offline
            hskoglundH Offline
            hskoglund
            wrote on last edited by
            #5

            Hi, SHA1 is an enum in Qt (qtbase/src/3rdparty/rfc6234/sha.h):

            typedef enum SHAversion {
                SHA1, SHA224, SHA256, SHA384, SHA512
            } SHAversion;
            

            Perhaps there's a name collision occurring?

            B 1 Reply Last reply
            1
            • hskoglundH hskoglund

              Hi, SHA1 is an enum in Qt (qtbase/src/3rdparty/rfc6234/sha.h):

              typedef enum SHAversion {
                  SHA1, SHA224, SHA256, SHA384, SHA512
              } SHAversion;
              

              Perhaps there's a name collision occurring?

              B Offline
              B Offline
              BrianN
              wrote on last edited by
              #6

              @hskoglund

              My simple test was to comment out the lines in winnt.h which is obviously a bad idea but it did allow me to compile and run my program.

              Any ideas how I can progress further in resolving this in a clean way?

              Thanks

              aha_1980A 1 Reply Last reply
              0
              • B BrianN

                @hskoglund

                My simple test was to comment out the lines in winnt.h which is obviously a bad idea but it did allow me to compile and run my program.

                Any ideas how I can progress further in resolving this in a clean way?

                Thanks

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @BrianN

                There must be a file in your program where both headers (winnt.h and sha.h) are both included (direct or indirectly). You need to first find out where this happens.

                Then maybe you can work with namespaces to silent this error.

                Qt has to stay free or it will die.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  BrianN
                  wrote on last edited by
                  #8

                  @aha_1980

                  I have no direct include for "sha.h" so I was trying to figure out how to add /showincludes as an option.

                  Is there anyway to get a full view of all included files?

                  Thanks

                  Brian

                  1 Reply Last reply
                  0
                  • hskoglundH Offline
                    hskoglundH Offline
                    hskoglund
                    wrote on last edited by
                    #9

                    Hi, turns out Qt is innocent (that sha.h is just a 3rdparty file).
                    I think it's a #define in your program that's the culprit. I created a new empty vanilla Qt Widgets program and changed mainwindow.cpp to this:

                    #include "mainwindow.h"
                    #include "ui_mainwindow.h"
                    //#define SHA1 42
                    #include "Windows.h"
                    #include "winnt.h"
                    
                    MainWindow::MainWindow(QWidget *parent) :
                        QMainWindow(parent),
                        ui(new Ui::MainWindow)
                    {
                        ui->setupUi(this);
                    }
                    
                    MainWindow::~MainWindow()
                    {
                        delete ui;
                    }
                    

                    Now if you uncomment that #define on line 3 and compile with MSVC2017 you'll get the same error. So look for a similar flavored #define in your program.

                    B 1 Reply Last reply
                    2
                    • hskoglundH hskoglund

                      Hi, turns out Qt is innocent (that sha.h is just a 3rdparty file).
                      I think it's a #define in your program that's the culprit. I created a new empty vanilla Qt Widgets program and changed mainwindow.cpp to this:

                      #include "mainwindow.h"
                      #include "ui_mainwindow.h"
                      //#define SHA1 42
                      #include "Windows.h"
                      #include "winnt.h"
                      
                      MainWindow::MainWindow(QWidget *parent) :
                          QMainWindow(parent),
                          ui(new Ui::MainWindow)
                      {
                          ui->setupUi(this);
                      }
                      
                      MainWindow::~MainWindow()
                      {
                          delete ui;
                      }
                      

                      Now if you uncomment that #define on line 3 and compile with MSVC2017 you'll get the same error. So look for a similar flavored #define in your program.

                      B Offline
                      B Offline
                      BrianN
                      wrote on last edited by
                      #10

                      @hskoglund

                      Exactly that. I found the offending item and I can change it.

                      Thanks for your help.

                      Brian

                      aha_1980A 1 Reply Last reply
                      1
                      • B BrianN

                        @hskoglund

                        Exactly that. I found the offending item and I can change it.

                        Thanks for your help.

                        Brian

                        aha_1980A Offline
                        aha_1980A Offline
                        aha_1980
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @BrianN

                        Perfect! So it was in your code?

                        And please mark this thread as SOLVED so others know a solution was found. Thanks!

                        Qt has to stay free or it will die.

                        B 1 Reply Last reply
                        0
                        • aha_1980A aha_1980

                          @BrianN

                          Perfect! So it was in your code?

                          And please mark this thread as SOLVED so others know a solution was found. Thanks!

                          B Offline
                          B Offline
                          BrianN
                          wrote on last edited by
                          #12

                          @aha_1980

                          Yes it was in an 'external' part of my code but I have the source and can change it.

                          Thanks again for your support.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved