记录VS2010下用BCGControlBar编译程序时的一个小问题

链接期错误信息如下:

1>BCGCBPRO1200StaticUD100.lib(BCGPGridCtrl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPFrameImpl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPFullScreenImpl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPDlgImpl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPAppBarWnd.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPToolTipCtrl.obj) : error LNK2019: unresolved external symbol _xGetSystemMetrics@4 referenced in function “protected: void __thiscall CBCGPToolTipCtrl::OnShow(struct tagNMHDR *,long *)” (?OnShow@CBCGPToolTipCtrl@@IAEXPAUtagNMHDR@@PAJ@Z)
1>BCGCBPRO1200StaticUD100.lib(Bcgglobals.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPVisualManager.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPPopupMenu.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@4
1>BCGCBPRO1200StaticUD100.lib(BCGPRibbonKeyTip.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPGridCtrl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPCalendarBar.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPRibbonCategory.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPInplaceToolTipCtrl.obj) : error LNK2019: unresolved external symbol _xGetMonitorInfo@8 referenced in function “public: void __thiscall CBCGPInplaceToolTipCtrl::Track(class CRect,class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)” (?Track@CBCGPInplaceToolTipCtrl@@QAEXVCRect@@ABV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)
1>BCGCBPRO1200StaticUD100.lib(BCGPAppBarWnd.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPGlobalUtils.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPFullScreenImpl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPDlgImpl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPDropDown.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPToolTipCtrl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(Bcgglobals.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPPopupMenu.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPFrameImpl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@8
1>BCGCBPRO1200StaticUD100.lib(BCGPGridCtrl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPRibbonCategory.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPInplaceToolTipCtrl.obj) : error LNK2019: unresolved external symbol _xMonitorFromPoint@12 referenced in function “public: void __thiscall CBCGPInplaceToolTipCtrl::Track(class CRect,class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)” (?Track@CBCGPInplaceToolTipCtrl@@QAEXVCRect@@ABV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)
1>BCGCBPRO1200StaticUD100.lib(BCGPAppBarWnd.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPRibbonKeyTip.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPFullScreenImpl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPDlgImpl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPDropDown.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPCalendarBar.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPToolTipCtrl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPPopupMenu.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPFrameImpl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(BCGPGlobalUtils.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@12
1>BCGCBPRO1200StaticUD100.lib(Bcgglobals.obj) : error LNK2019: unresolved external symbol _xEnumDisplayMonitors@16 referenced in function “public: void __thiscall BCGPGLOBAL_DATA::OnSettingChange(void)” (?OnSettingChange@BCGPGLOBAL_DATA@@QAEXXZ)

1>BCGCBPRO1200StaticUD100.lib(BCGPGridCtrl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPFrameImpl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPFullScreenImpl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPDlgImpl.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPAppBarWnd.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPToolTipCtrl.obj) : error LNK2019: unresolved external symbol _xGetSystemMetrics@4 referenced in function “protected: void __thiscall CBCGPToolTipCtrl::OnShow(struct tagNMHDR *,long *)” (?OnShow@CBCGPToolTipCtrl@@IAEXPAUtagNMHDR@@PAJ@Z)1>BCGCBPRO1200StaticUD100.lib(Bcgglobals.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPVisualManager.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPPopupMenu.obj) : error LNK2001: unresolved external symbol _xGetSystemMetrics@41>BCGCBPRO1200StaticUD100.lib(BCGPRibbonKeyTip.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPGridCtrl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPCalendarBar.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPRibbonCategory.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPInplaceToolTipCtrl.obj) : error LNK2019: unresolved external symbol _xGetMonitorInfo@8 referenced in function “public: void __thiscall CBCGPInplaceToolTipCtrl::Track(class CRect,class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)” (?Track@CBCGPInplaceToolTipCtrl@@QAEXVCRect@@ABV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)1>BCGCBPRO1200StaticUD100.lib(BCGPAppBarWnd.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPGlobalUtils.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPFullScreenImpl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPDlgImpl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPDropDown.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPToolTipCtrl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(Bcgglobals.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPPopupMenu.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPFrameImpl.obj) : error LNK2001: unresolved external symbol _xGetMonitorInfo@81>BCGCBPRO1200StaticUD100.lib(BCGPGridCtrl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPRibbonCategory.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPInplaceToolTipCtrl.obj) : error LNK2019: unresolved external symbol _xMonitorFromPoint@12 referenced in function “public: void __thiscall CBCGPInplaceToolTipCtrl::Track(class CRect,class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > const &)” (?Track@CBCGPInplaceToolTipCtrl@@QAEXVCRect@@ABV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)1>BCGCBPRO1200StaticUD100.lib(BCGPAppBarWnd.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPRibbonKeyTip.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPFullScreenImpl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPDlgImpl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPDropDown.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPCalendarBar.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPToolTipCtrl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPPopupMenu.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPFrameImpl.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(BCGPGlobalUtils.obj) : error LNK2001: unresolved external symbol _xMonitorFromPoint@121>BCGCBPRO1200StaticUD100.lib(Bcgglobals.obj) : error LNK2019: unresolved external symbol _xEnumDisplayMonitors@16 referenced in function “public: void __thiscall BCGPGLOBAL_DATA::OnSettingChange(void)” (?OnSettingChange@BCGPGLOBAL_DATA@@QAEXXZ)

MFC以及BCG库均使用静态库链接方式(不知其它方式是否也有可能出现……),解决方法如下:

在stdafx.h中加入

#define COMPILE_MULTIMON_STUBS

#include <multimon.h>

博主友情提示:

如在您的评论中需要提及如QQ号、微信号、电子邮件地址或其他隐私敏感信息,欢迎通过>>博主专用加密工具v2<<加密后发布,原文只有博主可以看到。