Adding #include lt;boost/thread/mutex.hppgt; breaks my ActiveX control?(添加#include lt;boost/thread/mutex.hppgt;破坏我的 ActiveX 控件?)
问题描述
在 ActiveX 控件中使用 boost::mutex 标头是否存在已知问题?
(Boost 版本 v1.39)
如果我在 Visual Studio 2008 中创建一个名为 "DefaultOCXControl" 的 MFC ActiveX 控件 项目,那么我可以构建它,该控件将自身注册为构建的一部分,并且可以按照您的预期插入到 ActiveX 测试容器中.都很好.
If I create an MFC ActiveX Control project in Visual Studio 2008 called "DefaultOCXControl" then I can build it, the control registers itself as part of the build, and can be inserted into the ActiveX Test Container as you would expect. All good.
如果我再添加这一行:
#include <boost/thread/mutex.hpp>
在我的 DefaultOCXControlCtrl.h
文件顶部并重新构建:构建结束时的注册步骤失败:
at the top of my DefaultOCXControlCtrl.h
file and rebuild: the registration step at the end of the build fails with:
调试断言失败!
程序:C:Windowssystem32
egsvr32.exe
文件:f:ddvctoolsvc7libsshipatlmfcsrcmfcdllinit.cpp
线路:587
Debug Assertion Failed!
Program: C:Windowssystem32 egsvr32.exe
File: f:ddvctoolsvc7libsshipatlmfcsrcmfcdllinit.cpp
Line: 587
有问题的断言如下所示:
The offending assertion looks like this:
void AFXAPI AfxCoreInitModule()
{
ASSERT(AfxGetModuleState() != AfxGetAppModuleState());
...
现在尝试将控件插入 ActiveX 测试容器会产生相同的消息.如果我删除该行并重建,那么一切都很好 - 所以它肯定似乎是那个头文件中的某些东西导致了这个问题.
Attempting to insert the control into the ActiveX Test Container now results in the same message. If I remove the line and rebuild then everything is fine - so it definitely seems to be something in that header file that causes the issue.
推荐答案
你试过动态链接boost::thread
吗(定义BOOST_THREAD_DYN_LINK)?
Have you tried linking boost::thread
dynamically (define BOOST_THREAD_DYN_LINK)?
在将 boost::thread
与混合 C++/.NET 项目一起使用时遇到此类问题,并且仅动态链接 boost::thread
是解决方案(此处一个可能的解释:http://article.gmane.org/gmane.comp.lib.boost.user/22617/match=clr)
I had this kind of problems when using boost::thread
with a mixed C++/.NET project and linking just boost::thread
dynamically was the solution (here a possible explanation: http://article.gmane.org/gmane.comp.lib.boost.user/22617/match=clr)
这篇关于添加#include <boost/thread/mutex.hpp>破坏我的 ActiveX 控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:添加#include <boost/thread/mutex.hpp>破坏我的 ActiveX 控件?


基础教程推荐
- 这个宏可以转换成函数吗? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 我有静态或动态 boost 库吗? 2021-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- C++结构和函数声明。为什么它不能编译? 2022-11-07