Qt 5.12.0 MSVC 2017 32 Bit
-
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
-
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
-
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
-
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.
-
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.