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

ICE 1.2 TryEnterCriticalSection problem


I'm working on a prototype and I started a new project using ICE 1.2 with Visual Studio .NET 2003 running on Window XP Professional.

The thing is, I'm getting confused by this message.

Build started: Project: JLibSink, Configuration: Debug Win32

Performing Custom Build Step
c:\Ice-1.2.0\include\IceUtil\Mutex.h(146) : error C3861: 'TryEnterCriticalSection': identifier not found, even with argument-dependent lookup
c:\Ice-1.2.0\include\IceUtil\Mutex.h(146) : error C3861: 'TryEnterCriticalSection': identifier not found, even with argument-dependent lookup
Generating Code...

Build log was saved at "file://d:\projects\JLibrary\JLibICE\Bin\BuildLog.htm"
JLibSink - 2 error(s), 0 warning(s)


Build: 0 succeeded, 1 failed, 0 skipped

The problem with it is that I'm not using/including <IceUtil/Mutex.h> so I don't know whats happening.

Any ideas?




  • mes
    mes California
    Hi Alex,

    The best way for us to help you would be for you to provide an archive of the smallest possible project that reproduces the problem. For example, include stdafx.h, stdafx.cpp, JLibSinkI.h and JLibSinkI.cpp, along with a project file. Try to remove any non-Ice dependencies from JLibSinkI.

    The next release of Ice will include MFC versions of the "hello" client and server, as a simple example of how to use Ice in MFC projects. We've also cleaned up the Ice header files in this respect. For example, it will no longer be necessary to compile Ice (or Ice applications) with /D_UNICODE.

    Take care,
    - Mark
  • Hello Mes,

    Thanks for the quick response. Its actually 4:25am and I haven't slept yet so I may be a little to the left of center. ;)

    I removed all the "proprietary" stuff and basically zipped-up a bare minimum of the code. The ICE client (JLibStream) compiles but the ICE server (JLibSink) still throws a fit.

    I hope you can get a better idea on whats happening. The wierd thing is, I have a similar code which I built using ICE 1.1 and Visual Studio .NET 2002 and it compiles without a hitch. I tried comparing the settings but I can't seem to find any illogical difference. :confused:

    Actually, I'm currently trying to cobble together the prototype using VB6 and WinSock until I figure out whats wrong with the ICE version. :(

    Thanks for the help, I really appreciate it.

  • Seem to have lost the attachment when posting it. Here it goes again. :)
  • mes
    mes California
    The error occurs because the preprocessor macro _WIN32_WINNT is not being set properly before the Windows header files are included.

    I fixed the error by adding the following code to stdafx.h after the initial #pragma:
    #ifndef _WIN32_WINNT
    #   define _WIN32_WINNT 0x400

    - Mark
  • Hello Mess,

    It worked ... although the code I posted had some embarrasingly n00b compile problems but at least the wierd error is gone.

    I was able to create an executable server and immediately test it with my client code.

    Again thanks.