Thursday, December 4, 2014

Error: syntax error: missing ';' before identifier 'hdr'

Problem
Visual Studio 2013/2015 build fails with error "prsht.h(607): error C2146: syntax error : missing ';' before identifier 'hdr'"

Cause
You didn't include the WinSDKVer.h header in stdafx.h. (Rebuild the project after changing stdafx.h).


Details
The brand new Visual Studio project has stdafx.h  and targetver.h:

// stdafx.h
#pragma once
#include "targetver.h"
#include <tchar.h>
#include <windows.h>

//  targetver.h
#pragma once
#include <WinSDKVer.h>

#ifndef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_MAXVER      // Change this to the appropriate value to target other versions of Windows.
//#define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
#endif

No comments:

Post a Comment