Reputation: 41
When I create new c++ console application (with MFC checkbox checked) in VS2010 I have a lot of errors during compilation connected with prsht.h
, zmouse.h
, commctrl.h
.
I did not change anything in this file so I have not idea what is wrong. What are this files and how I can compile program without errors?
Few of the many errors (113)
Error 13 error C1903: unable to recover from previous error(s); stopping compilation c:\program files (x86)\microsoft sdks\windows\v7.0a\include\prsht.h 97 1 qwert
Error 10 error C2065: 'CALLBACK' : undeclared identifier c:\program files (x86)\microsoft sdks\windows\v7.0a\include\prsht.h 97 1 qwert
19 IntelliSense: expected a ';' c:\program files (x86)\microsoft sdks\windows\v7.0a\include\commctrl.h 165 21
Error 2 error C2433: 'HWND' : 'inline' not permitted on data declarations c:\program files (x86)\microsoft sdks\windows\v7.0a\include\zmouse.h 141 1 qwert
Upvotes: 1
Views: 2034
Reputation: 1
You may not cancelled the define code generated by VS:
(in framework.h)
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN
This define command told complier not include some specific headers like Windows. You may forgot to check the MFC support when creating the project.
After comment the #define, it may help.
Upvotes: 0
Reputation: 1
These errors happened, because compiler treats symbols CALLBACK
, HWND
, etc. as new, it does not know them.
These symbols are defined in windows.h
header file.
So the diagnosis is: windows.h was not included
.
This can happen because of ruined SDK files, so you need to reinstall your SDK.
On my computer the header files are included in the following chain:
stdafx.h - afxwin.h - afx.h - afxver_.h - afxv_w32.h - windows.h
, zmouse.h
, commctrl.h
You can not include windows.h
explicitly (as it was suggested before), because afxv_w32.h
file has the following lines at the beginning:
#ifdef _WINDOWS_
#error WINDOWS.H already included. MFC apps must not #include <windows.h>
#endif
You can take a look at this: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/fff0ebaa-5153-40b9-89cf-cb9661abb2a4/
Upvotes: 0
Reputation: 11
You can try including the below in stdafx.h file before the #include "targetver.h" statement
#include "Winsock2.h"
#include "Windows.h"
#include "targetver.h"
Upvotes: 1