在Visual Studio 2010中使用/clr进行Boost
Boost in Visual Studio 2010 using /clr
我创建了一系列类,我希望将它们合并到Visual Studio 2010的Windows Forms应用程序中。这些类使用 Boost,特别是 boost::thread。
启用公共语言运行库支持后,我收到以下错误消息:
1>c:program files (x86)boostboost_1_47boostthreadwin32thread_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)boostboost_1_47boostthreadwin32basic_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 而不是静态链接它,也许它会以这种方式为您链接......
相关文章:
- 通过递归进行因子分解
- C++17复制构造函数,在std::unordereded_map上进行深度复制
- 在进程中对同一管道进行读取和写入时C++管道出现问题
- 我可以使用 g++ 进行三种比较 (<=>) 吗?
- 仅使用绝对值对数组进行排序,并在C++中显示实际值
- 使用libgit2、c++进行pull
- 为什么即使使用-cudart-static进行编译,库用户仍然需要链接到cuda运行时
- 如何使用模板函数的函数签名进行SFINAE
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- 将模板化的类型与C++中的某些类/类型进行比较
- 在c++中尝试对对象数组进行排序时,出现std:bad_alloc错误
- 如何对点云数据进行排序
- 从文本文件中读取时钟时间和事件时间并进行处理
- 对字符串进行位操作
- 是否可以使用winusb同时与多个相同的usb设备进行通信
- 是否可以对零模板参数进行模板专门化
- 对字符串进行排序时,在c++中处理sort()
- 试图对缓存进行跨步测试,但程序并没有结束
- 在Visual Studio 2010中使用/clr进行Boost
- C++CLR不会在调试之外进行编译