错误 1 error LNK2019: 无法解析的外部符号 __imp__CreatePropertySheetPageW@4,该符号在函数 "public: virtual long __stdcall CFileTimeShlExt::AddPages(int (__stdcall*)(struct _PSP *,long),long)" (?AddPages@CFileTimeShlExt@@UAGJP6GHPAU_PSP@@J@ZJ@Z) 中被引用 D:\C++ Work\PropertyPage\PropertyPage\FileTimeShlExt.obj PropertyPage
错误 2 error LNK2019: 无法解析的外部符号 __imp__DestroyPropertySheetPage@4,该符号在函数 "public: virtual long __stdcall CFileTimeShlExt::AddPages(int (__stdcall*)(struct _PSP *,long),long)" (?AddPages@CFileTimeShlExt@@UAGJP6GHPAU_PSP@@J@ZJ@Z) 中被引用 D:\C++ Work\PropertyPage\PropertyPage\FileTimeShlExt.obj PropertyPage
错误 3 error LNK2019: 无法解析的外部符号 __imp__InitCommonControlsEx@4,该符号在函数 "public: virtual long __stdcall CFileTimeShlExt::Initialize(struct _ITEMIDLIST const *,struct IDataObject *,struct HKEY__ *)" (?Initialize@CFileTimeShlExt@@UAGJPBU_ITEMIDLIST@@PAUIDataObject@@PAUHKEY__@@@Z) 中被引用 D:\C++ Work\PropertyPage\PropertyPage\FileTimeShlExt.obj PropertyPage
错误 2 error LNK2019: 无法解析的外部符号 __imp__DestroyPropertySheetPage@4,该符号在函数 "public: virtual long __stdcall CFileTimeShlExt::AddPages(int (__stdcall*)(struct _PSP *,long),long)" (?AddPages@CFileTimeShlExt@@UAGJP6GHPAU_PSP@@J@ZJ@Z) 中被引用 D:\C++ Work\PropertyPage\PropertyPage\FileTimeShlExt.obj PropertyPage
错误 3 error LNK2019: 无法解析的外部符号 __imp__InitCommonControlsEx@4,该符号在函数 "public: virtual long __stdcall CFileTimeShlExt::Initialize(struct _ITEMIDLIST const *,struct IDataObject *,struct HKEY__ *)" (?Initialize@CFileTimeShlExt@@UAGJPBU_ITEMIDLIST@@PAUIDataObject@@PAUHKEY__@@@Z) 中被引用 D:\C++ Work\PropertyPage\PropertyPage\FileTimeShlExt.obj PropertyPage
错误 4 error LNK1120: 3 个无法解析的外部命令 D:\C++ Work\PropertyPage\Debug\PropertyPage.dll 1 1 PropertyPage
本文解决了在C++项目中遇到的LNK2019错误,具体包括无法解析的外部符号问题,如CreatePropertySheetPageW、DestroyPropertySheetPage等,并提供了解决方案,即在代码中加入对comctl32.lib库的链接。
152

被折叠的 条评论
为什么被折叠?




一堆include结束后,加一行:#pragma comment(lib, "comctl32.lib")