MFC静态链接未解析的外部符号

时间:2013-12-20 00:38:51

标签: c++ visual-c++ mfc gyazowin

我正在尝试使用Use of MFC: Use MFC in a Static Library 构建自定义版本的GyazoWin,这会导致大量参考错误。

如何安装Visual Studio以便可以使用静态链接库进行构建?

更新

我设法将user32添加到链接库(我认为),现在我只有1/3的错误数量。谁能说出我现在缺少的图书馆?

Error   2   error LNK2019: unresolved external symbol __imp__BitBlt@36 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)  S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   3   error LNK2019: unresolved external symbol __imp__CreateCompatibleBitmap@12 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)  S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   4   error LNK2019: unresolved external symbol __imp__CreateCompatibleDC@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)   S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   5   error LNK2019: unresolved external symbol __imp__CreateFontW@56 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)   S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   6   error LNK2019: unresolved external symbol __imp__CreatePen@12 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z) S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   7   error LNK2019: unresolved external symbol __imp__CreateSolidBrush@4 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)   S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   8   error LNK2019: unresolved external symbol __imp__DeleteDC@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   9   error LNK2019: unresolved external symbol __imp__DeleteObject@4 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)   S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   10  error LNK2019: unresolved external symbol __imp__GetDeviceCaps@8 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)  S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   11  error LNK2019: unresolved external symbol __imp__GetStockObject@4 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)   S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   12  error LNK2019: unresolved external symbol __imp__Rectangle@20 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z) S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   13  error LNK2019: unresolved external symbol __imp__SelectObject@8 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)   S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   14  error LNK2019: unresolved external symbol __imp__SetBkMode@8 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)  S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   15  error LNK2019: unresolved external symbol __imp__SetTextColor@8 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)   S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   16  error LNK2019: unresolved external symbol __imp__TextOutW@20 referenced in function "long __stdcall LayerWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?LayerWndProc@@YGJPAUHWND__@@IIJ@Z)  S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   17  error LNK2019: unresolved external symbol __imp__ShellExecuteExW@4 referenced in function "void __cdecl execUrl(char const *)" (?execUrl@@YAXPBD@Z) S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   18  error LNK2019: unresolved external symbol __imp__SHGetSpecialFolderPathW@16 referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl getId(void)" (?getId@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\gyazowin\gyazowin.obj gyazowin
Error   19  error LNK1120: 17 unresolved externals  S:\Software\Microsoft\Visual Studio\Projects\Completed (New)\gyazowin\Debug\gyazowin.exe    gyazowin

1 个答案:

答案 0 :(得分:5)

对于平台库的功能:

  1. 使用您最喜爱的搜索引擎搜索该函数的名称(例如“GetStockObject”)。

  2. 在MSDN上查找该功能的文档(例如GetStockObject)。它通常是最好的结果之一。

  3. 在文档的“要求”下,找到“库”条目。这是您必须链接以使用该函数的库(对于GetStockObject,它是gdi32.lib)。

  4. 重复,直到您解决了所有错误。

相关问题