What causes compile errors referencing function 'TryEnterCriticalSection' for my Windows CORBA application?

Note: Applies to RTI Connext 4.x and above.

The TryEnterCriticalSection function is only declared in WinBase.h if _WINNT_WIN32 >= 0x400.  This symbol is defined within the ACE-TAO headers, which in turn are pulled in from Foo.h.  If an application includes ndds/ndds_cpp.h before including Foo.h, then WinBase.h will be included before the version symbol has been defined, resulting in a compile error.

Those upgrading from version 4.1 to 4.2 are most likely to encounter this error. In 4.1, the RTI header files did not bring in WinBase.h, so the generated example code included ndds_cpp.h before Foo.h.  Applications modeled after the example code are thus likely to use the  include order that prompts this problem.

In version 4.2 and higher, rtiddsgen produces example code with includes in this order:

#include "Foo.h"
#include "FooSupport.h"
#include "ndds/ndds_cpp.h"

You may need to rearrange the order of includes in your application to match this order.

Platform: