簡體   English   中英

使用/ clr在Visual Studio 2010中增強

[英]Boost in Visual Studio 2010 using /clr

我制作了一系列類,希望將它們合並到Visual Studio 2010的Windows窗體應用程序中。這些類利用Boost,特別是boost :: thread。

啟用公共語言運行時支持后,我收到以下錯誤消息:

1>c:\program files (x86)\boost\boost_1_47\boost\thread\win32\thread_primitives.hpp(314): error C2472: 'boost::detail::win32::interlocked_bit_test_and_set' cannot be generated in managed code: 'Found an intrinsic not supported in managed code'; compile with /clr to generate a mixed image

1>c:\program files (x86)\boost\boost_1_47\boost\thread\win32\basic_timed_mutex.hpp(160): error C2472: 'boost::detail::basic_timed_mutex::unlock' cannot be generated in managed code: 'Found an intrinsic not supported in managed code'; compile with /clr to generate a mixed image

我知道該消息在說什么,但我不知道如何解決。 在“項目屬性”中禁用公共語言運行時支持會導致大量其他錯誤,因此:如何將/ clr合並到我正在使用的Boost庫中?

Boost.thread使用一些線程本地存儲調用,如果您直接將它們與CLR代碼鏈接,則這些調用將不起作用。 在VS2008中,鏈接會成功,但啟動時會崩潰—我懷疑這是VS2010樣式的同一問題的征兆。 解決方法是將boost.thread構建為DLL而不是靜態鏈接,並且可能會以這種方式為您鏈接...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM