Click here to Skip to main content
14,735,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in the name of allah

hi everyone

i work on a project that contains the C and C++ Codes together.
the project source is in visual sutdio2008 and when i add the C++ files and codes side of C Files, the projects errors like below.
i need the both , please help me.

i don't #include <windows.h>
i even use

#ifdef _windows_
#undef _windows_

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxv_w32.h(20) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>

is it cause of #include <afxwin.h>?
i use the some codes and functions that need the afxwin.h.

the properties of project is : /MD use standard library
and i tried the /MT and shared dll library.

whats the problem?
thank you
Updated 4-Feb-15 22:48pm
Richard MacCutchan 5-Feb-15 3:50am
Impossible to tell exactly, but somewhere in the #include tree you are getting windows.h repeated. Look at the source file that is being compiled when this message occurs and trace back from there.

1 solution

Be sure that all afx inclusions precedes the other include.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900