I am trying to create a mixed mode (managed and unmanaged) C++ DLL with CLR option and I require the use of AFX library. So I included "afxwin.h" in a file (which uses GL/gl.h). However I run into compile errors no matter what I do and I have tried every option in the project settings to fix them, but no use.
A. When I compile with CLR option I see this error (when it compiles the file which includes afwin.h):
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afx.h(24): fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
B. When I compile with _AFXDLL defined in stdafx.cpp or enabling "Use MFC in a shared DLL", to address the error in A, I see these and whole bunch of other errors in the same file:
1> _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h) 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(46): error C2059: syntax error : '-' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(60): error C2143: syntax error : missing ';' before '}' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(60): error C2238: unexpected token(s) preceding ';' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(61): error C2059: syntax error : 'public' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(65): error C2059: syntax error : ')' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(65): error C2589: '-' : illegal token on right side of '::' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(65): error C2059: syntax error : '::' 1>c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\afxanimationcontroller.h(67): error C2143: syntax error : missing ';' before '{'
Any ideas on how to fix this issue? I am using VS 2010.