This forum has been archived. Please start a new discussion on GitHub.

"MFC" Help???

I have a problem with compile the mfc application.

For example:

#include <ice/ice.h>
class CEnterpriseConfigDlg : public CDialog

when i include the <ice/ice.h> file ,the follow errors are appeare .why?
i try a many times but also can not solve it. Thanks!!!!!!!!

Configuration: EnterpriseCenterMMC - Win32 Debug

..\code\ice-1.2.0\include\ice\config.h(83) : error C2065: 'WSAGetLastError' : undeclared identifier
..\code\ice-1.2.0\include\iceutil\mutex.h(146) : error C2065: 'TryEnterCriticalSection' : undeclared identifier
..\code\ice-1.2.0\include\iceutil\time.h(38) : error C2833: 'operator timeval' is not a recognized operator or type
..\code\ice-1.2.0\include\iceutil\time.h(38) : error C2059: syntax error : 'newline'
..\code\ice-1.2.0\include\iceutil\time.h(38) : error C2238: unexpected token(s) preceding ';'
Generating Code...
Error executing cl.exe.
Creating browse info file...
EnterpriseCenterMMC.exe - 5 error(s), 0 warning(s)


  • mes
    mes California

    The current release of Ice prefers that its header files be included before any other Windows headers. Unfortunately, that conflicts with many MFC applications, which require stdafx.h to be included first if you are using precompiled headers.

    The next release of Ice will be more flexible in this respect. Meanwhile, you should be able to fix this problem by modifying your stdafx.h file in two ways. First, add the following code at the beginning of the file (before any #include directives):
    #ifndef _WIN32_WINNT
    #   define _WIN32_WINNT 0x400
    Second, add the following line at the end of stdafx.h:
    #include <afxsock.h>
    If you're still having trouble, please attach a ZIP file of a small VC project that demonstrates the problem and we'll be happy to take a look at it.

    Take care,
    - Mark