解决无法链接GetFileVersionInfoSize、GetFileVersionInfo或VerQueryValue

xsvrDlg.obj : error LNK2019: unresolved external symbol _GetFileVersionInfoSizeW@8 referenced in function "public: int __thiscall CXsvrDlg::_UI_SetProductInfo(void)" (?_UI_SetProductInfo@CXsvrDlg@@QAEHXZ)
1>xsvrDlg.obj : error LNK2019: unresolved external symbol _GetFileVersionInfoW@16 referenced in function "public: int __thiscall CXsvrDlg::_UI_SetProductInfo(void)" (?_UI_SetProductInfo@CXsvrDlg@@QAEHXZ)

1>xsvrDlg.obj : error LNK2019: unresolved external symbol _VerQueryValueW@16 referenced in function "public: int __thiscall CXsvrDlg::_UI_SetProductInfo(void)" (?_UI_SetProductInfo@CXsvrDlg@@QAEHXZ)


msdn上说的是:https://msdn.microsoft.com/en-us/library/windows/desktop/ms647005(v=vs.85).aspx



实际上链接version.lib即可。

在项目设置中添加或者在代码中添加:

#pragma comment(lib, "version.lib")

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页