[shared_ptr] Cannot include shared_ptr.hpp in a Visual Studio .Net 2003 managed C++ file

When I include

Alice Johnson wrote:
When I include
in a file that has Compile as Managed set to Assembly support (/clr), I get: error C2373: 'InterlockedIncrement' : redefinition; different type modifiers C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinBase.h(1298) : see declaration of 'InterlockedIncrement'
I started with boost version 1.34.1, but have also tried 1.35.0 and 1.36.0
Is there any solution to this?
I'm not aware of one - /CLR is not officially supported by boost. Personally I hit about some severe problems in the context of CLR and there is not solution in sight. One of the real nasty things is a defect in the conversion of pointer-to-member to bool - which is the canonical way to check smart pointers: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac... Greetings from Bremen, Daniel Krügler

Daniel Krügler schrieb am Montag 06 Oktober 2008 um 11:25:
I'm not aware of one - /CLR is not officially supported by boost. Personally I hit about some severe problems in the context of CLR and there is not solution in sight. One of the real nasty things is a defect in the conversion of pointer-to-member to bool - which is the canonical way to check smart pointers:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedba ckID=339523
Greetings from Bremen,
Daniel Krügler
I never used CLR stuff myself, but AFAIK one of the fundamentals is automatic garbage collection (MS refers to this as "managed"). So everything relying on the deterministic behavior of C++ ctors/dtors won't work. I doubt anything in boost is written with automatic garbage collectors in mind. This article regarding the boehmgc shows how to wrap stl containers - http://www.ddj.com/cpp/184401632 I'm new to this topic as well, so please correct me if I'm wrong so far and with the following statement: there have to be clear interfaces between automatic gc code and normal deterministic code. Mixing doesn't work out of the box. Best, -- Maik

Alice Johnson:
When I include
in a file that has Compile as Managed set to Assembly support (/clr), I get: error C2373: 'InterlockedIncrement' : redefinition; different type modifiers C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinBase.h(1298) : see declaration of 'InterlockedIncrement'
I started with boost version 1.34.1, but have also tried 1.35.0 and 1.36.0
Is there any solution to this?
Does it work if you define the macro BOOST_USE_WINDOWS_H in the project settings?
participants (4)
-
Alice Johnson
-
Daniel Krügler
-
Maik Beckmann
-
Peter Dimov